CentOS 7.6 配置指南
1. System Initialization
Section titled “1. System Initialization”Basic Configuration & Packages
Section titled “Basic Configuration & Packages”# If using a laptop, prevent sleep on lid closesudo vim /etc/systemd/logind.conf# Add/Uncomment: HandleLidSwitch=ignoresudo systemctl restart systemd-logind
# Install EPEL and RPMForge repositorieswget http://repository.it4i.cz/mirrors/repoforge/redhat/el7/en/x86_64/rpmforge/RPMS/rpmforge-release-0.5.3-1.el7.rf.x86_64.rpmrpm -ivh rpmforge-release-0.5.3-1.el7.rf.x86_64.rpmsudo yum install epel-releasesudo yum upgrade
# Install essential development tools and librariessudo yum install net-tools gcc gcc-c++ clang make autoconf automake gettext gperf kernel-headers glibc-headers libcxx libcxx-devel libcutl libcutl-devel glibc-common vim wget htop ncdu axel openssl-devel ncurses-devel2. Upgrade GCC (to v9.2.0)
Section titled “2. Upgrade GCC (to v9.2.0)”CentOS 7 comes with an old GCC version. Follow these steps to compile and install GCC 9.2.0.
Install Dependencies
Section titled “Install Dependencies”GMP v6.1.0
axel ftp://gcc.gnu.org/pub/gcc/infrastructure/gmp-6.1.0.tar.bz2tar -jxvf gmp-6.1.0.tar.bz2cd gmp-6.1.0./configure && make && make installMPFR v3.1.4
axel ftp://gcc.gnu.org/pub/gcc/infrastructure/mpfr-3.1.4.tar.bz2tar -jxvf mpfr-3.1.4.tar.bz2cd mpfr-3.1.4./configure && make && make installMPC v1.0.3
axel ftp://gcc.gnu.org/pub/gcc/infrastructure/mpc-1.0.3.tar.gztar xf mpc-1.0.3.tar.bz2cd mpc-1.0.3./configure && make && make installISL v0.18
axel ftp://gcc.gnu.org/pub/gcc/infrastructure/isl-0.18.tar.bz2tar xf isl-0.18.tar.bz2cd isl-0.18/./configure && make && make installInstall GCC
Section titled “Install GCC”axel ftp://ftp.gnu.org/gnu/gcc/gcc-9.2.0/gcc-9.2.0.tar.gztar xf gcc-9.2.0.tar.gzcd gcc-9.2.0./configuremake && make install3. Python Environment
Section titled “3. Python Environment”Install Pip
Section titled “Install Pip”sudo yum install python2-pipsudo yum clean allsudo pip install --upgrade pipConfigure Pip Mirror (Aliyun)
Section titled “Configure Pip Mirror (Aliyun)”mkdir -p ~/.config/pipvim ~/.config/pip/pip.confAdd the following content:
[global]trusted-host = mirrors.aliyun.comindex-url = https://mirrors.aliyun.com/pypi/simple4. Network & Proxy
Section titled “4. Network & Proxy”Shadowsocks
Section titled “Shadowsocks”Installation
sudo pip install shadowsocksClient Usage
# sudo sslocal -c US04.jsonsudo sslocal -c US04.conf -d startPrivoxy (HTTP Proxy)
Section titled “Privoxy (HTTP Proxy)”Installation
sudo yum install privoxysudo vim /etc/privoxy/configConfiguration
Edit /etc/privoxy/config:
listen-address 127.0.0.1:8118listen-address [::1]:8118 # for ipv6forward-socks5 / 127.0.0.1:1080 . # global proxy via socks5Start Service
sudo service privoxy startsudo service privoxy statusEnvironment Variables
Temporary:
export https_proxy="http://127.0.0.1:8118"export http_proxy="http://127.0.0.1:8118"export ftp_proxy="http://127.0.0.1:8118"Permanent (User):
Add to ~/.bashrc:
proxy="http://127.0.0.1:8118"export https_proxy=$proxyexport http_proxy=$proxyexport ftp_proxy=$proxyexport no_proxy="localhost, 127.0.0.1, ::1, ip.cn, chinaz.com"PAC Proxy (gfwlist)
Section titled “PAC Proxy (gfwlist)”sudo pip install gfwlist2privoxycd /tmpwget https://raw.githubusercontent.com/gfwlist/gfwlist/master/gfwlist.txtgfwlist2privoxy -i gfwlist.txt -f gfwlist.action -p 127.0.0.1:1080 -t socks5sudo cp gfwlist.action /etc/privoxy/Add to /etc/privoxy/config:
actionsfile gfwlist.actionRestart Privoxy:
sudo service privoxy restart5. Development Tools
Section titled “5. Development Tools”Tmux v2.9a
Section titled “Tmux v2.9a”Dependencies (ncurses & libevent)
# ncurses v6.1wget ftp://ftp.invisible-island.net/ncurses/ncurses.tar.gztar zxf ncurses.tar.gzcd ncurses-6.1./configure && make && sudo make install
# libevent v2.1.11wget https://github.com/libevent/libevent/releases/download/release-2.1.11-stable/libevent-2.1.11-stable.tar.gztar zxf libevent-2.1.11-stable.tar.gzcd libevent-2.1.11-stable./configure && make && sudo make install
# Symlink fix if neededln -s /usr/local/lib/libevent-2.0.so.5 /usr/lib64/libevent-2.0.so.5Install Tmux
wget https://github.com/tmux/tmux/releases/download/2.9a/tmux-2.9a.tar.gztar zxf tmux-2.9a.tar.gzcd tmux-2.9a./configure && make && sudo make installZsh & Oh My Zsh
Section titled “Zsh & Oh My Zsh”Install Zsh v5.7.1
# Download source from https://sourceforge.net/projects/zsh/files/zsh/5.7.1/zsh-5.7.1.tar.xz/downloadcd zsh-5.7.1./configure && make && sudo make installInstall Oh My Zsh
sh -c "$(wget https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)"Plugins & Theme
git clone https://github.com/romkatv/powerlevel10k.git $ZSH_CUSTOM/themes/powerlevel10kgit clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlightingInstall from Source
yum install curl-devel expat-devel gettext-devel openssl-devel zlib-develwget https://mirrors.edge.kernel.org/pub/software/scm/git/git-2.22.1.tar.gztar zxf git-2.22.1.tar.gzcd git-2.22.1./configure && make && sudo make installConfiguration
git config --global user.name "NTLx"git config --global user.email "lx3325360@gmail.com"# Proxygit config --global http.proxy http://127.0.0.1:8118git config --global https.proxy http://127.0.0.1:8118Rust & Cargo
Section titled “Rust & Cargo”Install
curl -sSf https://sh.rustup.rs | shsource $HOME/.cargo/envMirrors (USTC)
Edit ~/.bashrc:
export RUSTUP_DIST_SERVER=https://mirrors.ustc.edu.cn/rust-staticexport RUSTUP_UPDATE_ROOT=https://mirrors.ustc.edu.cn/rust-static/rustupEdit ~/.cargo/config:
[source.crates-io]registry = "https://github.com/rust-lang/crates.io-index"replace-with = 'ustc'[source.ustc]registry = "git://mirrors.ustc.edu.cn/crates.io-index"Ruby & RVM
Section titled “Ruby & RVM”Install RVM
sudo gpg2 --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB\curl -sSL https://get.rvm.io | bash -s stablesource ~/.bashrcsource ~/.bash_profileInstall Ruby
echo "ruby_url=https://cache.ruby-china.com/pub/ruby" > ~/.rvm/user/dbrvm install 2.6.3 --disable-binaryrvm use 2.6.3 --defaultGem Mirror
gem sources --add https://gems.ruby-china.com/ --remove https://rubygems.org/NodeJS
Section titled “NodeJS”axel https://nodejs.org/dist/v12.11.0/node-v12.11.0.tar.gztar xf node-v12.11.0.tar.gzcd node-v12.11.0./configure && make && make installJava JDK v1.8
Section titled “Java JDK v1.8”Download jdk-8u221-linux-x64.tar.gz from Oracle.
tar -zxf jdk-8u221-linux-x64.tar.gz# Add to ~/.bashrcexport JAVA_HOME=/home/lx/jdk1.8.0_221export CLASSPATH=.:${JAVA_HOME}/jre/lib/rt.jar:${JAVA_HOME}/lib/dt.jar:${JAVA_HOME}/lib/tools.jarexport PATH=$PATH:${JAVA_HOME}/bin6. Services
Section titled “6. Services”Samba (SMB)
Section titled “Samba (SMB)”Install & Configure
sudo yum install samba samba-libs samba-client samba-common samba-common-libs samba-common-toolssudo touch /etc/samba/smbpasswdsudo vim /etc/samba/smb.confMinimal Config (/etc/samba/smb.conf)
[global] workgroup = WORKGROUP security = user netbios name = HaseeServer hosts allow = 192.168.0. passdb backend = smbpasswd encrypt passwords = true smb passwd file = /etc/samba/smbpasswd log file = /var/log/samba/log.%m max open files = 1000
[SSD] comment = Hasee SSD Download folder path = /home/lx/Download valid users = lx writable = no browseable = yes available = yesUser & Service
sudo smbpasswd -a lxsudo service smb startGitLab
Section titled “GitLab”Install Dependencies
sudo yum install curl policycoreutils openssh-server openssh-clients postfixsudo systemctl enable postfixsudo systemctl start postfixInstall GitLab CE
# Add Tsinghua Mirrorsudo vim /etc/yum.repos.d/gitlab-ce.repo# [gitlab-ce]# name=Gitlab CE Repository# baseurl=https://mirrors.tuna.tsinghua.edu.cn/gitlab-ce/yum/el$releasever/# gpgcheck=0# enabled=1
sudo yum makecachesudo yum install gitlab-ceConfigure (/etc/gitlab/gitlab.rb)
external_url 'http://ntlx.tpddns.cn:45678'gitlab_rails['smtp_enable'] = truegitlab_rails['smtp_address'] = "smtp.exmail.qq.com"# ... other smtp settingsStart
sudo gitlab-ctl reconfiguresudo gitlab-ctl status7. Bioinformatics Software
Section titled “7. Bioinformatics Software”HTSlib, Samtools, Bcftools
Section titled “HTSlib, Samtools, Bcftools”sudo yum install bzip2 bzip2-libs bzip2-devel xz xz-compat-libs xz-devel xz-libs xz-javacd ~/htslib-1.9./configure --prefix=/home/lx/software/htslib-1.9# Add to PATHexport PATH="/home/lx/software/htslib-1.9/bin:$PATH"export PATH="/home/lx/software/samtools-1.9/bin:$PATH"export PATH="/home/lx/software/bcftools-1.9/bin:$PATH"8. Troubleshooting
Section titled “8. Troubleshooting”- Find package provider:
yum provides ifconfig - Remove stubborn packages:
- Check package name:
rpm -qa | grep [package] - Remove:
rpm -e [package]
- Check package name: