Skip to content

安装vps系统后要做的事

本文以centos 6.9为例

上传本地RSA公钥

ssh-keygen -t rsa
ssh-copy-id -i ~/.ssh/id_rsa/pub root@104.225.146.204

安装常用工具

sudo yum install vim
sudo yum install git
sudo yum install zsh
sudo yum install gcc make automake

修改ssh超时时间

$ vim /etc/ssh/sshd_config
ClientAliveInterval 60
ClientAliveCountMax 3

这样保证ssh server 每隔一分钟向client发送一个包,client通常会返回一个包,从而实现不间断访问。

安装tmux

# install deps
yum install kernel-devel ncurses-devel

# install libevent
curl -OL https://github.com/libevent/libevent/releases/download/release-2.1.8-stable/libevent-2.1.8-stable.tar.gz
tar -zxvf libevent-2.1.8-stable.tar.gz
cd libevent-2.1.8-stable
./configure && make
sudo make install

# install tmux
curl -OL https://github.com/tmux/tmux/releases/download/2.5/tmux-2.5.tar.gz
tar -xzvf tmux-2.5
cd tmux-2.5
LDFLAGS="-L/usr/local/lib -Wl,-rpath=/usr/local/lib" ./configure --prefix=/usr/local
make
sudo make install

tmux -V

安装nginx server

nginx server相比apache,占用内存更少,应用更广。

sudo yum install epel-release
sudo yum install nginx

# 可能出现显示epel-release已安装但无法安装nginx的情况
# 此时,可以执行以下指令

sudo rpm -e epel-release
sudo yum install epel-release
sudo yum install nginx

# nginx开机自启动
sudo /etc/init.d/nginx start