1. Configure the Network
cat/etc/resolv.conf//View DNS
NETSTAT-RN//View Gateway
Vi/etc/sysconfig/network-scripts/ifcfg-eth0//Change network configuration
onboot= "Yes"
Bootproto=static
Add in this directory
Ipaddr= "IP"
netmask= "Subnets"
gateway= "Gateway"
dns1= "DNS"
ESC---input ": Wq"
/etc/init.d/network Restart//Restart Network
2. Configure Host
Vi/etc/sysconfig/network//change hostname (effective after reboot)
Hostname=zabbix.wtf.local//Change HOSTNAME
ESC---Enter ": Wq"//Save Exit
Hostname zabbix.wtf.local//Temporary VI Change host command
3. Firewall
/etc/init.d/iptables Status//view firewall configuration
/etc/init.d/iptables Stop//firewall off
Chkconfig iptables off//boot not boot firewall
4. Close Selnux
(1) Sed-i s#selinux=enforcing#selinux=disabled#g/etc/selinux/config//Turn off SELINUX
grep "Disable"/etc/selinux/config//See if replace succeeded
Getenforce 0//immediate effect
(2) Vi/etc/selinux/config//Turn off SELinux
Selinux=disabled
ESC---input ": Wq"
5. Yum Install tree telnet dos2unix sysstat lrzsz-y//install common software
6. Create User settings password
Useradd oldboy1//create User
passwd oldboy1//Add password
7. Switch users
Su-root//Switch User, must add-
8. Change the Yum source
Cp/etc/centos-base.repo Centos-base.repo.oir//backup original file
Cat/etc/yum.repos.d/centos-base.repo//view Yum source
wget http://mirrors.163.com/.help/CentOS6-Base-163.repo//download Yum source
CP Centos6-base-163.repo Centos-base.repo//replace original source
Yum grouplist//view installed package groups
9. Adjust the current mode
Vi/etc/inittab//view current mode, change to 3
0---shutdown mode
1---stand-alone mode
2---Multi-user mode
3---command-line mode
4---No usage mode
5---Desktop mode
6---Restart mode
init//Toggle Mode
10. Modify the boot entry
Chkconfig--list//View Startup items
11. Change the remote port
Vi/etc/ssh/sshd_config//Modify Port port number
12, under the ordinary user to use root permissions, sudo
Visudo//Edit normal user rights, edit in 99gg line, add format "Nopasswd:all"
sudo useradd 123
13, Chinese display (not recommended)
cat/etc/sysconfig/i18n//view Character Set
vi/etc/sysconfig/i18n//Edit Character Set
Lang= "ZH_CN. GB18030 "//Add this sentence
source/etc/sysconfig/i18n//Immediate effect
echo $LANG//See if it takes effect
14, Timing time synchronization
echo ' #time sync by Oldboy at 2010-2-1 ' >>/var/spool/cron/root
Echo ' */5****/usr/sbin/ntpdate time.nist.gov >/dev/null 2>&1 ' >>/var/spool/cron/root
Crontab-l//Check whether it takes effect
15. enlarge file descriptor (or 32768)
Ulimit-n//View file descriptor
ULIMIT-HSN 65535//pro-Active
Echo ' *-nofile 65535 ' >>/etc/security/limits.conf//Permanent
16. Adjust kernel parameters
vi/etc/sysctl.conf//Edit
SYSCTL-P//Effective documents
17, hidden version number
>/etc/issue
18. Lock Critical system files
Chattr +i/etc/passwd/etc/shadow/etc/group/etc/gshadow/etc/inittab//Lock critical system files
Chattr-i/etc/passwd/etc/shadow/etc/group/etc/gshadow/etc/inittab//Unlocking critical system files
LSATTR/ETC/PASSWD//See if the file is locked. Yes, I was locked.
This article is from the "11104762" blog, please be sure to keep this source http://11114762.blog.51cto.com/11104762/1812565
Linux Basic optimization