Installation of a .CentOS 7
Create a new virtual machine
Select the name and location of the virtual machine storage
The need to select the number of processors and memory
Select the disk capacity on demand
Select the disk file storage location
This virtual machine is turned on, move the cursor to "Install CentOS 7" press Tab, added to the front quite
net.ifnames=0 biosdevname=0
The size of swap is usually twice the memory
The rest of the space to the root
When using a kernel panic, temporarily without opening
Network Configuration
Set a password, the password is too simple point twice Done
After landing landing called restarting the root password for the password just set
Restart the network: systemctl network restart
There are two issues before us, ping nowhere Gateway (Baidu) is not connected with the xshell how to do?
Baidu ping nowhere: a general look at the IP address is configured correctly, if the DNS, the network card is incorrect
Not connect xshell, general firewall, selinux related
Summarizes the installation process:
- Create a virtual machine
- Add a piece of card -> LAN segment
- Centos7.5 mount CD image (may https://msdn.itellyou.cn/ download)
- Power
- Select the language (English)
- Change the time zone -> Shanghai
- Minimizing installation
- Disk (default - the logical volume)
- Automatic configuration partition
- Analysis of the core cause of the crash, it does not open, need time to re-open the can
- Network Configuration
- Modify the host name
- Set the root password
Use xshell link corresponds centos7 server
CRT Links: https://www.lanzous.com/i6h6exg
II. Optimization of foundation
Change yum source;
Get yum source
-o curl /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
(Yum install -y wget must first install)
After running yum makecache generate cache
1.1 yum basic software installation
yum install -y wget
yum install net-tools vim tree htop iftop iotop lrzsz sl unzip telnet nmap nc psmisc dos2unix bash-completion nethogs glances -y
yum install yum-utils -y # install
Close firewalld Firewall 1.2
[root@centos75-model ~]# systemctl stop firewalld #停止
[Root @ centos75-model ~] # systemctl disable firewalld # close the boot from the start, Note: disable no d
[root@centos75-model ~]# systemctl status firewalld #检查
1.3 Close SELinux
[root@centos75-model ~]# setenforce 0
[root@centos75-model ~]# vim /etc/selinux/config
SELINUX=enforcing改成SELINUX=disabled
######### Both editing mode without opening the file ###########
# Way a
sed -ri 's#(^SELINUX=).*#\1disabled#g' /etc/selinux/config
# Second way
sed -i '/^SELINUX=/c SELINUX=disabled' /etc/selinux/config
an examination
getenforce
1.4 Optimization ulimit
echo '* - nofile 65535' >> /etc/security/limits.conf
1.5 显示优化
[ "$PS1" = "\\s-\\v\\\$ " ] && PS1="[\[\e[34;1m\]\u@\[\e[0m\]\[\e[32;1m\]\H\[\e[0m\] \[\e[31;1m\]\w\[\e[0m\]]\\$ "
添加到/etc/bashrc,注释掉原有的PS1,然后生效source /etc/bashrc
字符集改成UTF-8
1.6 SSH连接速度慢优化
sed -i 's@#UseDNS yes@UseDNS no@g' /etc/ssh/sshd_config
sed -i 's@^GSSAPIAuthentication yes@GSSAPIAuthentication no@g' /etc/ssh/sshd_config
systemctl restart sshd