CentOS settings(持续更新中)
by xiangxiang
CentOS/RHEL是最流行的服务器操作系统,所以我选择CentOS作为开发部署环境。 本文主要是配置CentOS至中国国内的源并安装常用的开发依赖。
CentOS安装
- 安装过程中网络配置hostname并打开网卡
- 替换yum源
#### centos7
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
curl https://lug.ustc.edu.cn/wiki/_export/code/mirrors/help/centos?codeblock=3 --output /etc/yum.repos.d/CentOS-Base.repo
yum makecache
- 安装vmtools和Development Tools
sudo yum install -y open-vm-tools
reboot
#### 更新系统
sudo yum check-update
sudo yum update
#### 开发环境工具
yum groupinstall 'Development Tools' -y
docker
sudo yum install -y yum-utils device-mapper-persistent-data lvm2
curl https://download.docker.com/linux/centos/docker-ce.repo --output /etc/yum.repos.d/docker-ce.repo
sudo sed -i 's+download.docker.com+mirrors.ustc.edu.cn/docker-ce+' /etc/yum.repos.d/docker-ce.repo
sudo yum makecache fast
sudo yum install docker-ce docker-ce-cli containerd.io
sudo systemctl enable docker
sudo systemctl start docker
- 修改docker hub地址
/etc/docker/daemon.json
后重启docker服务
{
"registry-mirrors": ["https://docker.mirrors.ustc.edu.cn/"]
}
python
- python3
sudo yum -y install python-virtualenv
sudo yum -y install python3 python3-pip python3-wheel python3-devel
- 修改python源
$HOME/.config/pip/pip.conf
mkdir -p /root/.config/pip touch $HOME/.config/pip/pip.conf
[global]
index-url = https://mirrors.ustc.edu.cn/pypi/web/simple
format = columns
disable firewall
systemctl disable firewalld
Clean disk space
find /var -name "*.log" -exec truncate {} --size 0 \;
yum clean all
rm -rf /var/cache/yum
rm -rf /var/tmp/yum-*
package-cleanup --quiet --leaves --exclude-bin | xargs yum remove -y
package-cleanup --oldkernels --count=1
history -c
mount VMware shared folders
/usr/bin/vmhgfs-fuse .host:/ /mnt/hgfs -o subtype=vmhgfs-fuse,allow_other