After installing a Linux system, we often need to do some initial configuration operations, the most visible is the need to modify the configuration of the following content.
1, set the IP address, you can edit /etc/sysconfig/network-scripts/ifcfg-eth0
Device=eth0//Physical Device NameBootproto=none//NONE|STATIC|BOOTP|DHCP (does not use protocol at boot time | static Assignment | BOOTP protocol | DHCP protocol) immediate effectNm_controlled=no//whether the device can be hosted by the Network Manager graphical management tool, default to YesOnboot=yes//whether the device is activated at system startupType=ethernet//ethernet| Bridge Network TypeIpaddr=192.168.100.2 //Specify IP addressnetmask=255.255.255.0 //Specify a network maskgateway=192.168.100.1 //Specify the Gateway
2. Set up DNS, edit/etc/resolv.conf
61.139. 2.69 202.98. 96.68
3, set the hostname, edit/etc/sysconfig/network
Hostname=5201351 // You can also use the HOSTNAME 5201351 command
4, close SELinux, edit /etc/selinux/config , you can also perform setenforce [enforcing | Permissive | 1 | 0] Command, edit the file, as follows:
selinux=disabled //
5, configure local Yum source, mount the optical drive to the/media/cdrom directory first.
[Email protected]5201351Mount /dev/cdrom/media/cdrom // If you don't have a CDROM directory, you'll need to create
Edit the /etc/fstab file to add the following:
/dev/cdrom /iso 00
Edit/etc/yum.repos.d/centos-media.repo file again
[c6-media]name=centos-$releasever- mediabaseurl=file:///media/centos/ file:///media/cdrom/ file://media/ cdrecorder/gpgcheck=0Enabled=1gpgkey=file:// /etc/pki/rpm-gpg/rpm-gpg-key-centos-6
6, time synchronization of the configuration, first installed NTP time Synchronization service, where NTPD is the server, but also the client.
[Email protected]5201351yumyuminstall ntp-y
Edit the NTPD Client Profile /etc/ntp.conf configuration file.
#server 0 .centos.pool.ntp.org#server 1 .centos.pool.ntp.org#server Span style= "color: #800080;" >2 . centos.pool.ntp.org // comment out the top 3 lines, Synchronize your own defined server server 192.168 . 100.200 server 192.168 . 100.210 prefer prefer priority server, You can define multiple master synchronization servers logfile/var/log/ntp.log // optional operation for logging information
If the prefer clock synchronization server is defined, NTP will use this server preferentially, unless it is determined that it cannot synchronize with it, and then re-select the other server as the synchronization server.
Initial configuration of Linux system after installation