写在前面
前面介绍过一些关于在 centos6.5 上配置开发环境的方法, 但是还是不够全面, 因为折腾坏了 openssh, 重装了新的 centos6.5, 于是又能折腾了…
总之就是, 先配置工具链(gcc), 然后安装一个同步更新比较快的包管理器(我推荐 brew), 最后美化.
首先是配置一下老旧的 centos 源镜像, 这里用到了阿里的 vault 源镜像, 现在支持 centos6 的少之甚少了…
连接篇
adduser zorch
passwd zorch
vi /etc/ssh/sshd_config
# 主要是注释掉密码登录
ssh-copy-id -i ~/.ssh/id_rsa zorch@xx.xx.xx.xx
添加管理员权限
chmod +w /etc/sudoers
vi /etc/sudoers
## Allow root to run any commands anywhere
root ALL=(ALL) ALL
zorch ALL=(ALL) NOPASSWD:ALL
chmod -w /etc/sudoers
bash/vim 的极简配置
# vi ~/.vimrc
" syntax highlight
syntax on
" show line number and relative number
set nu
" set rnu
" centos6.5 默认的 vim7 貌似不支持这个选项
" indent when newline
set smartindent
" close mouse mode
set mouse=
" use plugin
" filetype plugin on
" cancel backup and no generate swp file
set nobackup
set nowb
set noswapfile
" tab width =4
set tabstop=4
" indent = 4
set softtabstop=4
set shiftwidth=4
set expandtab
" jk -> <ESC>
inoremap jk <ESC>
" v as vis and select
vnoremap jk <ESC>
imap <C-E> <ESC>A
xnoremap @ :<C-u>call ExecuteMacroOverVisualRange()<CR>
function! ExecuteMacroOverVisualRange()
echo "@".getcmdline()
execute ":'<,'>normal @".nr2char(getchar())
endfunction
然后可以在 root 权限下 cp 一份过去:
# shell with root:
cp /home/zorch/.vimrc /root
然后简单加几条 alias:
# vi ~/.bashrc
alias vb='vi ~/.bashrc'
alias sb='source ~/.bashrc'
alias gcl='git clone'
alias ls='ls --color=always'
alias ll='ls -alh'
yum 源镜像
直接用的话会报错:
Loaded plugins: security
http://mirrors.cloud.aliyuncs.com/centos/6/os/x86_64/repodata/repomd.xml: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"
Trying other mirror.
Error: Cannot retrieve repository metadata (repomd.xml) for repository: base. Please verify its path and try again
这里需要删掉之前的镜像配置, 然后加入新的
参考了 centos-vault | 镜像站使用帮助 | 清华大学开源软件镜像站 | Tsinghua Open Source Mirror;
# always run shell as root
mv epel.repo epel.repo.bak # 这个用不到了
sed -e "s|^mirrorlist=|#mirrorlist=|g" \
-e "s|^#baseurl=http://mirror.centos.org/centos/\$releasever|baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos-vault/6.5|g" \
-e "s|^#baseurl=http://mirror.centos.org/\$contentdir/\$releasever|baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos-vault/6.5|g" \
-i.bak \
/etc/yum.repos.d/CentOS-*.repo
yum makecache
linuxbrew
wget https://mirrors.ustc.edu.cn/misc/brew-install.sh --no-check-certificate
bash brew-install.sh
# 提示
Homebrew requires Ruby 2.6 which was not found on your system.
Homebrew portable Ruby requires Glibc version 2.13 or newer,
and your Glibc version is too old. See:
https://docs.brew.sh/Homebrew-on-Linux#requirements
Please install Ruby 2.6 and add its location to your PATH.
安装 Ruby
By default, this will install Ruby into
/usr/local
. To change, pass the--prefix=DIR
option to the./configure
script.
sudo yum install gcc-c++ patch readline readline-devel zlib zlib-devel libffi-devel \
openssl-devel make bzip2 autoconf automake libtool bison sqlite-devel --skip-broken
wget https://cache.ruby-lang.org/pub/ruby/3.1/ruby-3.1.4.tar.gz
tar xvf ruby-3.1.4.tar.gz
cd ruby-3.1.4
./configure
make -j`nproc`
sudo make install
这个没啥难度
安装 glibc
前面说过了
安装 git2.7以上版本
前面有