Показаны сообщения с ярлыком Linux. Показать все сообщения
Показаны сообщения с ярлыком Linux. Показать все сообщения

10 окт. 2014 г.

on 1 comment

Setup IP-address in Linux

1. Change the ifcfg-eth1 file
Open the ifcfg-eth1 file by using the editor "VI"
[root@oracledb01 ~]# vi /etc/sysconfig/network-scripts/ifcfg-eth1

8 окт. 2014 г.

on

YUM repositories installation in RHEL and CENTOS

Hello,

Every Linux administrator should know how to install additional repositories for yum. So today I will tell to you how to do it.

1. Adding the RPMForge Repository
To Install Sourceforge repository use below download links.
CentOS/RHEL 6, 32 Bit (i686):
# rpm -Uvh http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.3-1.el6.rf.i686.rpm

CentOS/RHEL 6, 64 Bit (x86_64):
# rpm -Uvh http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm

CentOS/RHEL 5, 32 Bit (i386):
# rpm -Uvh http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.3-1.el5.rf.i386.rpm

CentOS/RHEL 5, 64 Bit (x86_64):
# rpm -Uvh http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.3-1.el5.rf.x86_64.rpm
2.Adding the EPEL Repository
To Install EPEL repository use below download links.
CentOS/RHEL 6, 32 Bit (i386):
# rpm -Uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm

CentOS/RHEL 6, 64 Bit x86_64):
# rpm -Uvh http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm

CentOS/RHEL 5, 32 Bit (i386):
# rpm -Uvh http://dl.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm

CentOS/RHEL 5, 64 Bit (x86_64):
# rpm -Uvh http://dl.fedoraproject.org/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm
3. Adding the REMI Repository
To Install REMI repository use below download links.
CentOS/RHEL 6, 32 Bit (i386):
# rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm 

CentOS/RHEL 6, 64 Bit (x86_64):
# rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm 

CentOS/RHEL 5, 32 Bit (i386):
# rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-5.rpm
 
CentOS/RHEL 5, 64 Bit (x86_64):
# rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-5.rpm
4.Addingthe Webtatic Repository
To Install webtatic repository use below download links.
CentOS/RHEL 6:
# rpm -Uvh http://repo.webtatic.com/yum/el6/latest.rpm

CentOS/RHEL 5:
# rpm -Uvh http://repo.webtatic.com/yum/centos/5/latest.rpm

22 авг. 2014 г.

on

Linux configure default gateway using route command

1. Check whether you have already configured default gateway:

$ route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
172.16.0.0      *               255.255.255.0   U     1      0        0 eth3
192.168.88.0    *               255.255.255.0   U     1      0        0 eth2
10.1.1.0        *               255.255.255.0   U     1      0        0 eth1
192.168.122.0   *               255.255.255.0   U     0      0        0 virbr0

2. If you have no default gateway you can use the command above to add it:

$ route add default gw {ip-address} {interface-name}
Where,
  • IP-ADDRESS: Specify router IP address
  • INTERFACE-NAME: Specify interface name such as eth0

Example:
$ route add default gw 172.16.0.1 eth3




23 июл. 2014 г.

on Leave a Comment

Примеры команды CUT

Команда CUT может быть использована для вывода, например, только определенных колонок из результата вывода какой-то команды или текстового файла.

Ниже приведены примеры, как можно использовать эту команду:

Допустим у нас есть вот такой файл с именами:
  $ cat /tmp/names.txt    
  Avdeeva:Irina:Vladimirovna  
  Alekseev:Sergey:Viktorovich  
  Borisova:Elena:Vladimirovna  
  Gordeeva:Larisa:Andreevna

Вывести 1-е поле(фамилия) из файла:
  $ cut -d':' -f 1 /tmp/names.txt
  Avdeeva
  Alekseev
  Borisova
  Gordeeva

Вывести 2-е и 3-е поле(фамилия) из файла:
  $ cut -d':' -f 2,3 /tmp/names.txt
  Irina:Vladimirovna
  Sergey:Viktorovich
  Elena:Vladimirovna
  Larisa:Andreevna

Вывести только первые 11 символов каждой строки из файла:
  $ cut -c 1-11  /tmp/names.txt
  Avdeeva:Iri
  Alekseev:Se
  Borisova:El
  Gordeeva:La

Более реальный пример. Например у нас есть файл /etc/oratab:
   $ cat /etc/oratab
  # This file is used by ORACLE utilities.  It is created by root.sh
  # and updated by the Database Configuration Assistant when creating
  # a database.

  # A colon, ':', is used as the field terminator.  A new line terminates
  # the entry.  Lines beginning with a pound sign, '#', are comments.
  #
  # Entries are of the form:
  #   $ORACLE_SID:$ORACLE_HOME:<N|Y>:
  #
  # The first and second fields are the system identifier and home
  # directory of the database respectively.  The third filed indicates
  # to the dbstart utility that the database should , "Y", or should not,
  # "N", be brought up at system boot time.
  #
  # Multiple entries with the same $ORACLE_SID are not allowed.
  #
  #
  ORCL0:/u01/app/oracle/product/10.2.0/db_1:N
  ORCL1:/u01/app/oracle/product/10.2.0/db_1:N
  ORCL2:/u01/app/oracle/product/10.2.0/db_1:N
  ORCL3:/u01/app/oracle/product/10.2.0/db_1:Y
  ORCL4:/u01/app/oracle/product/10.2.0/db_1:Y
  ORCL5:/u01/app/oracle/product/10.2.0/db_1:Y
  ORCL6:/u01/app/oracle/product/10.2.0/db_1:Y

  ORCL7:/u03/app/oracle/product/11.2.0/dbhome_1:N
  ORCL8:/u03/app/oracle/product/11.2.0/dbhome_1:N
  ORCL9:/u03/app/oracle/product/11.2.0/dbhome_1:N
  ORCL10:/u03/app/oracle/product/11.2.0/dbhome_1:N
  ORCL11:/u03/app/oracle/product/11.2.0/dbhome_1:N


И задача: Вывести только пути к ORACLE_HOME, причем не повторяющиеся:

  $ cat /etc/oratab|egrep ':N|:Y'|grep -v \*|cut -f 2  -d':'|uniq
  /u01/app/oracle/product/10.2.0/db_1
  /u03/app/oracle/product/11.2.0/dbhome_1

Технологии Blogger.