CentOS 6 新装服务器部署流程

本文提供了CentOS系统的基础配置步骤,包括时区设置、内网IP配置、yum源配置、SELinux关闭、防火墙配置等关键操作,适用于系统管理员进行快速部署。

1、设置时区

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

2、配置内网IP (如果是外网IP,linux要修改远程端口)

3、配置自己的yum源

yum install wget
rm -f /etc/yum.repos.d/CentOS-Base.repo
wget -P /etc/yum.repos.d/ http://mirrors.163.com/.help/CentOS6-Base-163.repo
wget -P /etc/yum.repos.d/ http://mirrors.aliyun.com/repo/epel-6.repo

或者

curl http://mirrors.163.com/.help/CentOS6-Base-163.repo >/etc/yum.repos.d/comratings.repo
curl http://mirrors.aliyun.com/repo/epel-6.repo > /etc/yum.repos.d/epel-6.repo

如何需要最新版本的rpm包,请安装下面的仓库

rpm -Uvh http://repo.webtatic.com/yum/el6/latest.rpm

4、关闭SELinux

sed -i 's#SELINUX=enforcing#SELINUX=disabled#g' /etc/selinux/config
setenforce 0

5、添加zabbix监控

6、配置防火墙

service iptables stop
iptables -L
service iptables save

7、安装软件包

yum install -y vim openssh-clients ntpdate man lrzsz

8、配置定时任务

echo "$((RANDOM%60)) $((RANDOM%24)) * * * /usr/sbin/ntpdate time1.aliyun.com" >> /var/spool/cron/root

9、配置主机名

10、修改文件句柄数

#临时修改,立刻生效
ulimit -n 655350         

#永久修改
echo "* soft nofile 655360" >> /etc/security/limits.conf
echo "* hard nofile 655360" >> /etc/security/limits.conf

11、可以禁用ipv6

cat >> /etc/modprobe.d/ipv6.conf <<EOF
alias net-pf-10 off
alias ipv6 off
EOF

12、去除ssh远程DNS认证

sed -i 's/#UseDNS yes/UseDNS no/g' /etc/ssh/sshd_config
sed -i 's/GSSAPIAuthentication yes/GSSAPIAuthentication no/g' /etc/ssh/sshd_config
service sshd restart

13、配置LDAP客户端(可选)

yum install openldap-clients nss-pam-ldapd -y
authconfig --enablemkhomedir \
--disableldaptls \
--enablemd5 \
--enableldap \
--enableldapauth \
--ldapserver=ldap://xxx.x.x.27:8389 \
--ldapbasedn="dc=wzlinux,dc=com" \
--enableshadow \
--update

14、安装python3(rpm方式)

  • 安装yum源
    yum install https://centos6.iuscommunity.org/ius-release.rpm -y
  • 可以安装的版本很多,我们这里安装python3.6
    yum install -y python36u python36u-libs python36u-devel python36u-pip
  • 验证
    [root@monitor ~]# python3.6
    Python 3.6.5 (default, Apr 10 2018, 17:08:20) 
    [GCC 4.4.7 20120313 (Red Hat 4.4.7-18)] on linux
    Type "help", "copyright", "credits" or "license" for more information.
    >>> exit()
    [root@monitor ~]# python3.6 -V
    Python 3.6.5
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符  | 博主筛选后可见
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值