您的位置:首页 > 其它

Ubuntu 新装服务器部署流程

2017-11-23 15:35 302 查看

1、设定时区

rm -f /etc/localtime
cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime

2、配置apt-get源

sed -i 's/us.archive/cn.archive/g' /etc/apt/sources.list
sed -i 's/security.ubuntu/cn.archive.ubuntu/g' /etc/apt/sources.list

3、修改主机名

vim /etc/hostname

4、安装软件包

apt-get install lrzsz ntpdate

5、开启root登录

Ubuntu 14.04

sed -i 's/without-password/yes/g' /etc/ssh/sshd_config

Ubuntu 16.04

sed -i 's/prohibit-password/yes/g' /etc/ssh/sshd_config

重启服务

service ssh restart

6、踢出终端tty用户

pkill -kill -t tty

7、删除普通用户

8、时间同步

echo "$((RANDOM%60)) $((RANDOM%24)) * * * /usr/sbin/ntpdate time1.aliyun.com" >> /etc/crontab

9、安装监控系统

apt-get install zabbix-agent

10、配置pip国内源

mkdir .pip
cat >> .pip/pip.conf <<EOF
[global]
trusted-host =  pypi.douban.com
index-url = http://pypi.douban.com/simple EOF

附:配置IP

修改文件/etc/network/interfaces

auto eth0
iface eth0 inet static
address  10.0.0.100
netmask  255.0.0.0
gateway  10.0.0.1
dns-nameservers 114.114.114.114
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息