Skip to content

Centos从0安装

约 420 字大约 1 分钟

折腾

2019-11-14

安装 wget

 yum -y install wget

Linux:CentOS7 安装 MySQL8(详) - Jaywee - 博客园 (cnblogs.com)

查看安装的程序

rpm -qa|grep [关键字]
rpm -e --nodeps [文件名]

升级 python

  • 安装 gcc yum install gcc

  • 下载 解压移动 安装

    cd /home && mkdir -p downloads
    cd downloads
    wget https://www.python.org/ftp/python/3.6.5/Python-3.6.5.tgz
    tar -xf Python-3.6.5.tgz
    mv Python-3.6.5 python3.6
    mv python3.6 /usr/bin
    cd /usr/bin/python3.6
    ./configure
    make && make install
  • 先查看当前 python 的软连接

    • ls -al /usr/bin/python
  • 重命名软连接

    • mv /usr/bin/python /usr/bin/python_bak2.7
  • 软连接指向新版本

    • ln -s /usr/local/bin/python3.6 /usr/bin/python
  • 更改 yum 配置,软连接改了 yum 不可用

    • vi /usr/bin/yum 第一行改成 #!/usr/bin/python2.7 也看你的 python 历史版本是什么 改成对应的就行
  • 安装 pip

    • 更改 yum 系统配置文件使用的 python 版本 vim /usr/libexec/urlgrabber-ext-down 第一行改为 #! /usr/bin/python2.7
    • yum -y install epel-release
    • yum -y install python-pip

安装 ss

pip install shadowsocks
  • 编辑配置文件

    
    {
     	"server":"ip",
    	"local_address": "127.0.0.1",
    	"local_port":1080,
    	"port_password": {
      	    "端口":"密码",
    	    "端口":"密码",
     	    "端口": "密码"
    	},
     	"timeout":300,
    	"method":"aes-192-cfb",
     	"fast_open": false
     }
  • 加入系统服务

    vi /etc/systemd/system/shadowsocks.service
    [Unit]
    Description=Shadowsocks
    [Service]
    TimeoutStartSec=0
    ExecStart=/usr/bin/ssserver -c /etc/shadowsocks.json
    [Install]
    WantedBy=multi-user.target
    #写入
  • 启动

    systemctl enable shadowsocks #开机自启
    
    systemctl start shadowsocks #启动
    systemctl stop shadowsocks    #停止
    systemctl restart shadowsocks   #重启
    systemctl status shadowsocks #当前状态

安装 nginx

  • 安装 yum install -y nginx

  • 命令

    systemctl enable nginx #开机自启
    
    systemctl start nginx #启动
    ps -ef | grep -v grep | grep nginx #验证是否启动
    vi /etc/nginx/nginx.conf #配置文件

异常

启动 nginx 的时候 Error: No space left on device

先检查磁盘有没有满

df -h
df -i

如果磁盘没满

vi /etc/sysctl.conf


#写入
fs.inotify.max_user_watches = 3276854

#之后从新加载配置文件
sysctl -p /etc/sysctl.conf