1、设置root密码 sudo passwd 2、修改sshd配置文件 vi /etc/ssh/sshd_config PermitRootLogin without-password -> PermitRootLogin yes echo "UseDNS no" >> /etc/ssh/sshd_config sed -i 's/GSSAPIAuthentication yes/#GSSAPIAuthentication yes/g' /etc/ssh/ssh_config sed -i 's/GSSAPIDelegateCredentials no/#GSSAPIDelegateCredentials no/g' /etc/ssh/ssh_config echo " StrictHostKeyChecking no" >> /etc/ssh/ssh_config systemctl restart sshd 3、关闭防火墙 ufw disable ufw status 4、挂载磁盘 (1) fdisk分区(最大2.2TB) fdisk /dev/sdb n p w mkfs -t ext4 /dev/sdb1 (2) parted分区(没有限制) parted /dev/sdc mklabel gpt p unit s print free mkpart primary 0% 100% unit s print free q mkfs -t ext4 /dev/sdc1 (3) 挂载 mkdir /data echo "/dev/sdb1 /srv ext4 defaults 0 0" >> /etc/fstab echo "/dev/sdc1 /data ext4 defaults 0 0" >> /etc/fstab cat /etc/fstab 5、apache服务 cd /etc/apache2 sed -i 's#Directory /var/www/#Directory /srv/www/htdocs#g' /etc/apache2/apache2.conf sed -i 's#DocumentRoot /var/www/html#DocumentRoot /srv/www/htdocs#g' /etc/apache2/sites-available/000-default.conf sed -i 's#DocumentRoot /var/www/html#DocumentRoot /srv/www/htdocs#g' /etc/apache2/sites-available/default-ssl.conf sed -i 's#ServerTokens OS#ServerTokens Prod#g' /etc/apache2/conf-available/security.conf sed -i 's#ServerSignature On#ServerSignature Off#g' /etc/apache2/conf-available/security.conf apache2ctl -k restart 6、配置网桥 vi /etc/network/interfaces auto br10 iface br10 inet static bridge_ports p1p1 address 10.67.252.18 netmask 255.255.255.0 gateway 10.67.252.1 broadcast 10.67.252.255 auto br192 iface br192 inet static bridge_ports p4p2 address 192.168.0.18 netmask 255.255.0.0 broadcast 192.168.255.255 bridge_stp off bridge_fd 0 bridge_maxwait 0 bridge_maxage 12 7、取消dash dpkg-reconfigure dash 选择No 或者: echo "dash dash/sh boolean false" | debconf-set-selections DEBIAN_FRONTEND=noninteractive dpkg-reconfigure dash 8、配置网络源 # ubuntu16.04.3 echo "deb http://8.92.9.30/productrepo/repo/ubuntu-16.04.3-server-amd64/ xenial main" > /etc/apt/sources.list apt-get update # ubuntu16.04.6 echo "deb http://8.92.9.30/productrepo/repo/ubuntu-16.04.6-server-amd64/ xenial main" > /etc/apt/sources.list apt-get update 9、安装编译器 apt install -y gcc apt install -y g++ apt install -y make apt install -y vsftpd 10、配置pip源 mkdir /root/.pip PIP_CONF="/root/.pip/pip.conf" echo "[global]" > ${PIP_CONF} #echo "trusted-host=mirrors.aliyun.com" >> ${PIP_CONF} #echo "index-url=http://mirrors.aliyun.com/pypi/simple/" >> ${PIP_CONF} echo "trusted-host=repo.huaweicloud.com" >> ${PIP_CONF} echo "index-url=https://repo.huaweicloud.com/repository/pypi/simple" >> ${PIP_CONF} echo "timeout = 120" >> ${PIP_CONF} cat ${PIP_CONF} 11、配置网络源(华为云apt源) cp -a /etc/apt/sources.list /etc/apt/sources.list.bak sed -i "s@http://.*archive.ubuntu.com@http://mirrors.huaweicloud.com@g" /etc/apt/sources.list sed -i "s@http://.*security.ubuntu.com@http://mirrors.huaweicloud.com@g" /etc/apt/sources.list apt update # Ubuntu16.04源 echo "deb http://mirrors.huaweicloud.com/ubuntu/ xenial main restricted" > /etc/apt/sources.list echo "deb http://mirrors.huaweicloud.com/ubuntu/ xenial-updates main restricted" >> /etc/apt/sources.list echo "deb http://mirrors.huaweicloud.com/ubuntu/ xenial universe" >> /etc/apt/sources.list echo "deb http://mirrors.huaweicloud.com/ubuntu/ xenial-updates universe" >> /etc/apt/sources.list echo "deb http://mirrors.huaweicloud.com/ubuntu/ xenial multiverse" >> /etc/apt/sources.list echo "deb http://mirrors.huaweicloud.com/ubuntu/ xenial-updates multiverse" >> /etc/apt/sources.list echo "deb http://mirrors.huaweicloud.com/ubuntu/ xenial-backports main restricted universe multiverse" >> /etc/apt/sources.list echo "deb http://mirrors.huaweicloud.com/ubuntu xenial-security main restricted" >> /etc/apt/sources.list echo "deb http://mirrors.huaweicloud.com/ubuntu xenial-security universe" >> /etc/apt/sources.list echo "deb http://mirrors.huaweicloud.com/ubuntu xenial-security multiverse" >> /etc/apt/sources.list cat /etc/apt/sources.list apt update 12、修改时区 tzselect rm -f /etc/localtime cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime echo 'Asia/Shanghai' > /etc/timezone echo "export TZ='Asia/Shanghai'" >> /etc/profile