这篇文章主要思想和方法来自于SeisMan的博文<用CentOS打造合适的科研环境>, 但是很多 步骤直接省略或是合并, 同时也添加了我自己查阅总结的一些方法, 书成此文, 以供以后 做系统时参考查阅.

CentOS 安装

CentOS 安装U盘制作: UltraISO 1. 进入安装界面, 在”Install CentOS 7” 上按 TAB 2. 将命令修改为 >vmlinuz initrd=initrd.img linux dd quiet 3. 回车后找到U盘设备号 4. 重启, 将第二步改为 >vmlinuz initrd=initrd.img inst.stage2=hd:/dev/sdc4 quiet 5. OK

添加第三方源

yum install epel-release
rpm -Uvh http://li.nux.ro/download/nux/dextop/el7/x86_64/nux-dextop-release-0-5.el7.nux.noarch.rpm
yum install yum-axelget
wget http://repo.fdzh.org/chrome/google-chrome-mirrors.repo -P /etc/yum.repos.d/
rpm -ivh http://linuxdownload.adobe.com/adobe-release/adobe-release-x86_64-1.0-1.noarch.rpm
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-adobe-linux

添加常用工具&软件

yum install net-tools
yum install cmake
yum install ntfs-3g
yum install clang
yum install clang-analyzer
yum install google-chrome-stable
yum install flash-plugin
yum install p7zip
yum install unrar
yum install terminator
yum install zsh
yum install autojump
yum install autojump-zsh
yum install nfs-utils
yum install ImageMagick
yum install vlc
yum install redis
yum install lua luajit lua-devel luajit-devel
yum install python-pip python-devel
pip install mycli

Git 源码安装与配置

git部分有必要开专门的文档详解

  • 下载源码

    git clone https://github.com/git/git.git
    
  • 安装依赖

    yum -y install gcc openssl openssl-devel curl curl-devel unzip perl perl-devel expat expat-devel zlib zlib-devel asciidoc xmlto gettext-devel openssh-clients
    
  • 编译安装

    make prefix=/usr/local/git all    
    make prefix=/usr/local/git install
    
  • 加入环境变量

    vim /etc/profile
    export $GIT_HOME=/usr/local/git
    export PATH=$GIT_HOME/bin:$GIT_HOME/libexec/git-core:$PATH
    source /etc/profile
    
  • 配置用户

    git config --global user.name "louis"
    git config --global user.email "louis.tianlu@gmail.com"
    ssh-keygen -t rsa -C "louis.tianlu@gmail.com"
    

WPS Atom VSCode VmWareWorkstation

可以直接去官网下载安装

Python3 环境搭建

下载Python3

./configure --prefix=/usr/local/python3
make && make install
// 以下慎改
cd /usr/bin
mv python python.bak
ln -s /usr/local/python3/bin/python3 /usr/bin/python
vi /usr/bin/yum
#!/usr/bin/python --> #!/usr/bin/python2.7
    vim /usr/libexec/urlgrabber-ext-down
#!/usr/bin/python --> #!/usr/bin/python2.7

VIM 编译安装(提前安装python python3 及 *-devel)

git clone https://github.com/vim/vim.git
yum install ncurses ncurses-devel readline readline-devel
./configure --prefix=/usr --with-features=huge --enable-rubyinterp
--enable-pythoninterp --enable-python3interp --enable-luainterp
--with-lua-prefix=/usr
make && make install

Golang 环境搭建

安装到/opt
yum install gcc glibc-devel
git clone https://github.com/golang/go.git
cp go go1.4 -rf

cd go1.4
git checkout -b 1.4.3 go1.4.3
cd src
./all.bash

export GOROOT_BOOTSTRAP=/opt/go1.4

cd go/src
./all.bash

vim /etc/profile

# Golang Env
export PATH=$PATH:/opt/go/bin
export GOPATH=/home/golang/go-projects

Openresty 安装

yum install gcc readline-devel pcre-devel openssl-devel postgresql-devel
wget https://openresty.org/download/ngx_openresty-1.7.10.2.tar.gz
./configure --prefix=/opt/openresty 
--with-luajit 
--without-http_redis2_module 
--with-http_iconv_module 
--with-http_postgres_module
make && make install

MySQL 安装

yum install mysql-devel
insert into mysql.user(Host,User,Password) values("%","louis",password("St@271828"));
grant select,delete,update,create,drop on *.* to louis@"%" identified by
"St@271828";

Nginx 配置文件语法高亮

http://www.vim.org/scripts/download_script.php?src_id=19394
mkdir /home/louis/.vim/syntax
cp nginx.vim syntax
touch /home/louis/.vim/filetype.vim
au BufRead,BufNewFile /home/louis/openresty/nginx/conf/* if &ft == '' | setfiletype nginx | endif

git man 高亮

git config --global color.status auto
git config --global color.branch auto

Set colors for man pages

vim /etc/bash.bashrc

man() {
env \
LESS_TERMCAP_mb=$(printf "\e[1;31m"]) \
LESS_TERMCAP_md=$(printf "\e[1;31m"]) \
LESS_TERMCAP_me=$(printf "\e[0m"]) \
LESS_TERMCAP_se=$(printf "\e[0m"]) \
LESS_TERMCAP_so=$(printf "\e[1;44;33m"]) \
LESS_TERMCAP_ue=$(printf "\e[0m"]) \
LESS_TERMCAP_us=$(printf "\e[1;32m"]) \
man "$@"
}

source /etc/bash.bashrc