CentOS7基本配置
...大约 1 分钟
设置中科大源
注意:需要先切换root用户
su -
# ===================================
# 镜像源设置开始
# ===================================
# 添加中科大centos7镜像源
cp /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak \
&& sed -e 's|^mirrorlist=|#mirrorlist=|g' \
-e 's|^#baseurl=http://mirror.centos.org/centos|baseurl=https://mirrors.ustc.edu.cn/centos|g' \
-i.bak \
/etc/yum.repos.d/CentOS-Base.repo
yum makecache \
&& yum clean all
安装开发工具包、系统软件
# 安装epel源
yum install epel-release -y
# 安装DNF
yum install dnf -y
# 安装dnf插件及neofetch
dnf install dnf-plugins-core -y
dnf copr enable konimex/neofetch -y
dnf install neofetch -y
安装开发工具
# 安装开发工具
dnf groupinstall "Development Tools" -y
# dnf groupinstall "X Window System" -y \
# && dnf groupinstall xfce -y \
# && dnf install pixman pixman-devel libXfont -y
# 升级git2
dnf install \
https://repo.ius.io/ius-release-el7.rpm \
https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm \
-y
dnf remove git -y
dnf install git236 -y
安装Vim等工具
# 安装其他工具包
dnf install sudo \
vim \
net-tools \
wget \
-y
安装zsh
dnf install zsh -y
安装on-my-zsh
# 给root用户安装oh-my-zsh
git clone https://gitee.com/mirrors/oh-my-zsh.git ~/.oh-my-zsh \
&& cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc \
&& git clone https://gitee.com/playerfs/zsh-autosuggestions.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions \
&& git clone https://gitee.com/playerfs/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting \
&& sed -i 's/^plugins=(/plugins=(zsh-autosuggestions zsh-syntax-highlighting /' ~/.zshrc \
&& chsh -s /bin/zsh
# 为普通用户再安装一次oh-my-zsh
git clone https://gitee.com/mirrors/oh-my-zsh.git ~/.oh-my-zsh \
&& cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc \
&& git clone https://gitee.com/playerfs/zsh-autosuggestions.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions \
&& git clone https://gitee.com/playerfs/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting \
&& sed -i 's/^plugins=(/plugins=(zsh-autosuggestions zsh-syntax-highlighting /' ~/.zshrc
# 添加自定义环境变量
echo "source ~/my_profile.sh" >> ~/.zshrc
chsh -s /bin/zsh
vim ~/my_profile.sh
参考
https://github.com/terwer/portable-centos-7-workstation/blob/main/centos-7-vnc/Dockerfile
Powered by Waline v2.14.9