CentOS7.3最小化安装后所做的部署(minimal)

CentOS7.3最小化安装后所做的部署(minimal)


1.配置网卡

使用 ip addr / ip link 命令 查看网卡信息
$ ip addr

输出:
1: lo: mtu 65536 qdisc noqueue state UNKNOWN qlen 1
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: enp0s3: mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 08:00:27:6d:16:e9 brd ff:ff:ff:ff:ff:ff
inet 192.168.8.158/24 brd 192.168.8.255 scope global enp0s3
valid_lft forever preferred_lft forever
inet6 fe80::a00:27ff:fe6d:16e9/64 scope link
valid_lft forever preferred_lft forever

编辑网卡配置文件:
$ vi /etc/sysconfig/network-scripts/ifcfg-enp0s3

删除原有配置写入下面配置:

DEVICE=enp0s3
NAME=enp0s3
UUID=ca98a2b8-0b8d-4508-af64-affdcb559111
TYPE=Ethernet
BOOTPROTO=static
ONBOOT=yes
HWADDR=08:00:27:6D:16:E9
IPADDR=192.168.8.158
GATEWAY=192.168.8.1
BROADCAST=192.168.8.255
NETMASK=255.255.255.0
NETWORK=192.168.8.0
IPV6INIT=no
NETWORK_IPV6=no
IPV6_AUTOCONF=no

#BOOTPROTO=dhcp //无法连接网络增加(me)

编辑dns服务器,否则无法解析域名:

$ vi /etc/resolv.conf

默认为空文件,改为下面配置:
nameserver 192.168.8.1

重启网络:
$ systemctl restart network

安装epel源
$ yum install epel-release -y
$ yum clean all
$ yum update

安装ifconfig工具:
$ yum install net-tools -y

安装 wget
$ yum install wget -y

安装 gcc 编译器
$ yum install gcc -y

安装开发工具包
$ yum groupinstall “Development Tools”

安装ntfs支持
$ yum install ntfs-3g -y

安装pppoe拨号上网工具
$ yum install rp-pppoe -y
执行pppoe-setup配置账号密码
配置好以后,密码存在/etc/ppp/chap-secrets
其他配置信息存在/etc/sysconfig/network-scripts/ifcfg-ppp0

关闭firewalld防火墙服务,启用iptables防火墙:
$ systemctl stop firewalld
$ systemctl disable firewalld
$ yum install iptables-services -y

$ systemctl enable iptables
$ systemctl start iptables

如果想要使用 iptables save 命令,可以使用:
$ /usr/libexec/iptables/iptables.init save

2.编译安装git

使用yum安装依赖:
$ yum update && yum upgrade && yum install -y curl-devel expat-devel gettext-devel openssl-devel zlib-devel cpp cpp-devel perl perl-devel

下载git源码:
$cd /usr/local/src
$ wget https://github.com/git/git/archive/v2.8.1.tar.gz
$ tar -zxvf v2.8.1.tar.gz
$ cd git-2.8.1

开始编译
$ make
$ mkdir /usr/local/git-2.8.1 -p
$ make install prefix=/usr/local/git-2.8.1

将bin目录加到path变量
$ export PATH=$PATH:/usr/local/git-2.8.1/bin

修改profile
$ vi /etc/profile

在文件末尾加入下面内容:
#git path
export PATH=$PATH:/usr/local/git-2.8.1/bin

检查是否安装成功
$ git --version

得到输出:
git version 1.8.3.1

安装成功

3.编译安装vim

下载源码
$ cd /usr/local/src
$ wget ftp://ftp.vim.org/pub/vim/unix/vim-7.4.tar.bz2
$ tar -jxvf vim-7.4.tar.bz2

安装依赖
$ yum install ncurses -y
$ yum install ncurses-libs -y
$ yum install ncurses-devel -y

编译
$ cd vim74
$ mkdir /usr/local/vim-7.4 -p
$ ./configure --with-features=huge --enable-rubyinterp --enable-pythoninterp --enable-gui=auto --enable-cscope --enable-luainterp --enable-multibyte --prefix=/usr/local/vim-7.4
$ make
$ make install

将bin目录加到path变量
$ export PATH=$PATH:/usr/local/vim-7.4/bin

修改profile
$ vi /etc/profile

在文件末尾加入下面内容:
#vim path
export PATH=$PATH:/usr/local/vim-7.4/bin

检查是否安装成功
$ vim --version

得到输出
VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Feb 12 2017 23:34:25)
Compiled by [email protected]
Huge version without GUI. Features included (+) or not (-):
+arabic +file_in_path +mouse_sgr +tag_binary
+autocmd +find_in_path -mouse_sysmouse +tag_old_static
-balloon_eval +float +mouse_urxvt -tag_any_white
-browse +folding +mouse_xterm -tcl
++builtin_terms -footer +multi_byte +terminfo
+byte_offset +fork() +multi_lang +termresponse
+cindent +gettext -mzscheme +textobjects



此处信息太多省略

安装成功

部署vim配置文件:
$ cd ~
$ mkdir ~/.vim
$ cd ~/.vim
$ git clone https://github.com/chawuciren/vim-integration ./
$ ln -s ~/.vim/.vimrc ~/.vimrc
$ git submodule init
$ git submodule update

等待git拉取子模块完成
$ vim

在vim中执行Vundel的安装命令
:VundleInstall

等待安装完成

4.下载golang的二进制包并安装

浏览器中访问页面https://golang.org/dl/,找到最新稳定版安装包
下载二进制安装包
$ cd /usr/local/src
$ wget https://storage.googleapis.com/golang/go1.7.5.linux-amd64.tar.gz
$ tar -zxvf go1.7.5.linux-amd64.tar.gz
$ mv ./go /usr/local/go-1.7.5

将bin目录加到path变量
$ export GOROOT=/usr/local/go-1.7.5
$ export PATH= P A T H : PATH: PATH:GOROOT/bin
$ export GOPATH=/data/go/default:/data/go/project
$ export PATH=$PATH:/data/go/default/bin

修改profile
$ vi /etc/profile

在文件末尾加入下面内容:
#golang path
export GOROOT=/usr/local/go-1.7.5
export PATH= P A T H : PATH: PATH:GOROOT/bin
export GOPATH=/data/go/default:/data/go/project
export PATH=$PATH:/data/go/default/bin

创建golang的项目目录
$ mkdir /data/go/default -p
$ mkdir /data/go/default/bin -p
$ mkdir /data/go/default/pkg -p
$ mkdir /data/go/default/src -p
$ mkdir /data/go/project -p
$ mkdir /data/go/project/bin -p
$ mkdir /data/go/project/pkg -p
$ mkdir /data/go/project/src -p

验证是否安装成功
$ go

得到输出信息:
Go is a tool for managing Go source code.

Usage:

go command [arguments]

The commands are:

build       compile packages and dependencies
clean       remove object files
doc         show documentation for package or symbol




此处信息太多省略

5.下载node.js的二进制包并安装

浏览器中访问页面https://nodejs.org/zh-cn/download/,找到最新LTS包
下载
$ cd /usr/local/src
$ wget https://nodejs.org/dist/v6.9.5/node-v6.9.5-linux-x64.tar.xz
$ tar -xvf node-v6.9.5-linux-x64.tar.xz
$ mv ./node-v6.9.5-linux-x64 /usr/local/node.js-6.9.5

将bin目录加到path变量
$ export PATH=$PATH:/usr/local/node.js-6.9.5/bin

修改profile
$ vi /etc/profile

在文件末尾加入下面内容:
#node.js path
export PATH=$PATH:/usr/local/node.js-6.9.5/bin

验证是否安装成功:
$ node -v

得到输出信息
v6.9.5

安装成功

6.准备安装nginx、mysql、php

关闭SELINUX
$ vi /etc/selinux/config

#SELINUX=enforcing # 注释掉
#SELINUXTYPE=targeted # 注释掉
SELINUX=disabled #增加

重启 centos
$ reboot -n

7.下载软件

$ cd /usr/local/src

下载 nginx(目前稳定版)
$ wget http://nginx.org/download/nginx-1.9.9.tar.gz

下载 pcre(支持nginx 伪静态)
$ wget https://sourceforge.net/projects/pcre/files/pcre/8.40/pcre-8.40.tar.gz

下载 MySQL (下载带boost版本,如果不带需要在编译前另外下载)
$ wget http://mirrors.sohu.com/mysql/MySQL-5.7/mysql-boost-5.7.17.tar.gz

下载 php
$ wget http://cn2.php.net/distributions/php-5.6.30.tar.gz

下载 cmake(MySQL 编译工具)
$ wget https://cmake.org/files/v3.7/cmake-3.7.1.tar.gz

下载 libmcrypt(PHPlibmcrypt 模块)
$ wget http://nchc.dl.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz

下载 headers-more-nginx-module(nginx 模块/可不装)
$ wget https://github.com/openresty/headers-more-nginx-module/archive/master.zip -O headers-more-nginx-module.zip

下载freetype
$ wget http://download.savannah.gnu.org/releases/freetype/freetype-2.7.1.tar.gz

8.安装编译工具及库文件(使用 CentOS yum命令安装)

$ yum install make apr* autoconf automake cmake bison-devel curl-devel gcc gcc-c++ zlib-devel openssl openssl-devel pcre-devel gd kernel keyutils patch perl kernel-headers compat* mpfr cpp glibc libgomp libstdc+±devel ppl cloog-ppl keyutils-libs-devel libcom_err-devel libsepol-devel libselinux-devel krb5-devel zlib-devel libXpm* freetype libjpeg* libpng* php-common php-gd ncurses* libtool* libxml2 libxml2-devel patch -y

(以上执行失败){
cmake 安装:
1.使用yum安装
CentOS 7安装的命令为: sudo yum install cmake
安装后查看版本为: cmake version 2.8.12.2

2.使用源码安装(当你想要获取更高版本的cmake)
$yum erase cmake//卸载原先cmake
$wget https://cmake.org/files/v3.9/cmake-3.9.0.tar.gz//下载
$tar xvf cmake-3.9.0.tar.gz //解压
$cd cmake-3.9.0
$./configure
$make
$make install //在/usr/local/bin可以看到cmake可执行程序,添加cmake到PATH环境变量中
$cmake --version //查看版本为3.9.0

记得make install的时候需要root 权限 可以sudo make install

}

9.安装mysql

mysql使用的配置在实际安装中使用了以下配置:
添加 mysql组
$ groupadd mysql

创建用户 mysql并加入到mysql 组,不允许 mysql用户直接登录系统
$ useradd -g mysql mysql -s /bin/false

创建 MySQL数据库存放目录
$ mkdir -p /data/mysql

设置权限
$ chown -R mysql:mysql /data/mysql

创建安装目录
$ mkdir -p /usr/local/mysql-5.7.17
$ cd /usr/local/src
$ tar -zxvf mysql-boost-5.7.17.tar.gz
$ cd mysql-5.7.17

配置(从5.7开始boost为必须,所以需要带上boost参数)
$ cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql-5.7.17
-DMYSQL_UNIX_ADDR=/tmp/mysql.sock
-DDEFAULT_CHARSET=utf8
-DDEFAULT_COLLATION=utf8_general_ci
-DWITH_EXTRA_CHARSETS=all
-DWITH_MYISAM_STORAGE_ENGINE=1
-DWITH_INNOBASE_STORAGE_ENGINE=1
-DWITH_MEMORY_STORAGE_ENGINE=1
-DWITH_READLINE=1
-DENABLED_LOCAL_INFILE=1
-DMYSQL_DATADIR=/data/mysql
-DMYSQL_USER=mysql
-DMYSQL_TCP_PORT=3306
-DSYSCONFDIR=/etc
-DINSTALL_SHAREDIR=share
-DWITH_BOOST=boost
-DWITH_SYSTEMD=1 \

编译 
$ make

#安装  
$ make install
$ cd /usr/local/mysql-5.7.17

把mysql服务加入系统环境变量
$ export PATH=$PATH:/usr/local/mysql-5.7.17/bin
$ vi /etc/profile

在最后添加下面这一行
export PATH=$PATH:/usr/local/mysql-5.7.17/bin

下面这步,由于 /etc/my.cnf文件一般已经存在,容易覆盖失败,应该先移除再复制 :
$ rm /etc/my.cnf

拷贝配置文件 (注意:/etc 目录下面默认有一个 my.cnf,直接覆盖即可)  
$ cp support-files/my-default.cnf /etc/my.cnf

编辑配置文件 ,在 [mysqld] 部分增加
$ mkdir /var/log/mysqld
$ chown -R mysql:mysql /var/log/mysqld/
$ mkdir /var/run/mysqld
$ chown -R mysql:mysql /var/run/mysqld/
$ vi /etc/my.cnf

将文件改为下面内容:
[client]
port = 63306
socket = /tmp/mysql.sock

[mysqld]
user = mysql
port = 63306
basedir = /usr/local/mysql-5.7.17
datadir = /data/mysql
socket = /tmp/mysql.sock
log-error = /var/log/mysqld/mysql-error.log
pid-file=/data/mysql/mysql.pid
#open_files_limit = 10240
back_log = 600
max_connections = 500
max_connect_errors = 6000
wait_timeout = 605800
max_allowed_packet = 32M
sort_buffer_size = 4M
join_buffer_size = 4M
thread_cache_size = 300
query_cache_type = 1
query_cache_size = 256M
query_cache_limit = 2M
query_cache_min_res_unit = 16k

tmp_table_size = 256M
max_heap_table_size = 256M

key_buffer_size = 384M
read_buffer_size = 2M
read_rnd_buffer_size = 8M
bulk_insert_buffer_size = 64M
myisam_sort_buffer_size = 64M

lower_case_table_names = 1

default-storage-engine = INNODB
innodb_buffer_pool_size = 1G
innodb_log_buffer_size = 32M
innodb_log_file_size = 128M
innodb_flush_method = O_DIRECT

skip-external-locking
table_open_cache = 512
#thread_concurrency = 8
log-bin=mysql-bin
server-id = 1

long_query_time = 2
slow-query-log = on
slow-query-log-file = /var/log/mysqld/mysql-slow.log

[mysqldump]
quick
max_allowed_packet = 32M

[mysql]
no-auto-rehash

[mysqld_safe]
log-error=/var/log/mysqld/mysqld-error.log
pid-file=/data/mysql/mysqld.pid

[myisamchk]
key_buffer_size = 256M
sort_buffer_size = 256M
read_buffer = 2M
write_buffer = 2M

[mysqlhotcopy]
interactive-timeout

生成 mysql系统数据库
$ cd /usr/local/src/mysql-5.7.17/
$ mysqld --initialize-insecure --user=mysql --basedir=/usr/local/mysql-5.7.17 --datadir=/data/mysql

把Mysql加入系统服务
$ cp /usr/local/mysql-5.7.17/usr/lib/systemd/system/mysqld.service /usr/lib/systemd/system/

修改默认的pid路径
$ vim /usr/lib/systemd/system/mysqld.service

找到:
PIDFile=/var/run/mysqld/mysqld.pid
改为:
PIDFile=/data/mysql/mysqld.pid

找到:
ExecStart=/usr/local/mysql-5.7.17/bin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid $MYSQLD_OPTS
改为:
ExecStart=/usr/local/mysql-5.7.17/bin/mysqld --daemonize --pid-file=/data/mysql/mysqld.pid $MYSQLD_OPTS

加入开机启动 
$ systemctl enable mysqld

启动
$ systemctl start mysqld

下面这两行把 myslq的库文件链接到系统默认的位置,这样你在编译类似 PHP等软件时可以不用指定mysql的库文件地址 
$ ln -s /usr/local/mysql/lib/mysql /usr/lib/mysql   
$ ln -s /usr/local/mysql/include/mysql /usr/include/mysq

设置 Mysql密码
$ mysql_secure_installation

根据提示按 Y 回车输入2 次密码  
或者直接修改密码
$ /usr/local/mysql-5.7.17/bin/mysqladmin -u root -p password “123456”

需要重启系统,等待系统重新启动之后继续在终端命令行下面操作
$ reboot

10.安装PCRE

$ cd /usr/local/src
$ mkdir /usr/local/pcre-8.40
$ tar -zxvf pcre-8.40.tar.gz
$ cd pcre-8.40
$ ./configure --prefix=/usr/local/pcre-8.40
$ make
$ make install

11.安装nginx

$ cd /usr/local/src
$ groupadd www
$ useradd -g www www -s /bin/false
$ tar -zxvf nginx-1.9.9.tar.gz
$ unzip headers-more-nginx-module.zip
$ cd nginx-1.9.9
$./configure --prefix=/usr/local/nginx-1.9.9 --without-http_memcached_module --user=www --group=www --with-http_stub_status_module --with-openssl=/usr/ --with-pcre=/usr/local/src/pcre-8.40 --add-module=/usr/local/src/headers-more-nginx-module-master
$ make
$ make install

设置 nginx自启动,加入以下脚本
$ vim /usr/lib/systemd/system/nginx.service

[Unit]
Description=nginx - high performance web server
Documentation=https://nginx.org/en/docs/
After=network.target remote-fs.target nss-lookup.target php-fpm.service //php-fpm.service (PHP安装后加入)

[Service]
Type=forking
PIDFile=/usr/local/nginx/logs/nginx.pid
ExecStartPre=/usr/local/nginx/sbin/nginx -t -c /usr/local/nginx/conf/nginx.conf
ExecStart=/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s QUIT $MAINPID
PrivateTmp=true

[Install]
WantedBy=multi-user.target

$ systemctl enable nginx
$ systemctl start nginx

12、安装libmcrypt

$ cd /usr/local/src
$ tar zxvf libmcrypt-2.5.8.tar.gz
$ cd libmcrypt-2.5.8
$ mkdir /usr/local/libmcrypt-2.5.8 -p
$ ./configure --prefix=/usr/local/libmcrypt-2.5.8
$ make
$ make install

加入系统环境变量
$ export PATH=$PATH:/usr/local/libmcrypt-2.5.8/bin
$ vi /etc/profile

在最后添加下面这一行
#libmcrypt path
export PATH=$PATH:/usr/local/libmcrypt-2.5.8/bin

13.由于系统版本不同造成 freetype缺失有可能造成php的gd扩展无法正常工作,所以先编译安装 freetype:

编译安装 freetype
$ tar zxvf freetype-2.7.1.tar.gz
$ cd freetype-2.7.1
$ mkdir /usr/local/freetype-2.7.1 -p
$ ./configure --prefix=/usr/local/freetype-2.7.1
$ make
$ make install

加入系统环境变量
$ export PATH=$PATH:/usr/local/freetype-2.7.1/bin
$ vi /etc/profile

在最后添加下面这一行
#freetyp path
export PATH=$PATH:/usr/local/freetype-2.7.1/bin

14.准备安装sphinx

安装前请先确定安装了常用的组件,然后在官方网站下载最新的sphinx
$ yum install -y python python-devel

接着进入下面的页面下载sphinx稳定版源码:
http://sphinxsearch.com/downloads/release/

这里选择sphinx稳定版,下载源码。按照惯例我们将源码下载至/usr/local/src目录:
$ cd /usr/local/src
$ wget http://sphinxsearch.com/files/sphinx-2.2.11-release.tar.gz

15.安装配置sphinx

–prefix:指定 sphinx 的安装路径
–with-mysql:指定 mysql 安装路径

$ tar -zxvf sphinx-2.2.11-release.tar.gz
$ cd sphinx-2.2.11-release
$ mkdir /usr/local/sphinx-2.2.11 -p
$ mkdir /data/sphinx -p
$ ./configure --prefix=/usr/local/sphinx-2.2.11 --with-mysql=/usr/local/mysql-5.7.17
$ make
$ make install

16.SCWS中文分词

Scws官网:http://www.ftphp.com/scws/
1、下载

$ wget http://www.xunsearch.com/scws/down/scws-1.2.3.tar.bz2
$ tar -jxvf scws-1.2.3.tar.bz2
$ cd scws-1.2.3

  1. 安装
    $ mkdir /usr/local/scws-1.2.3
    $ ./configure --prefix=/usr/local/scws-1.2.3
    $ make
    $ make install

3.词库

scws-dict-chs-utf8.tar.bz2 解压放入 /usr/local/scws/etc
$ cd /usr/local/scws-1.2.3/etc/
$ wget http://www.xunsearch.com/scws/down/scws-dict-chs-utf8.tar.bz2
$ tar -jxvf scws-dict-chs-utf8.tar.bz2
$ rm scws-dict-chs-utf8.tar.bz2 -f
词库 dict.utf8.xdb
规则 rules.utf8.ini

17.安装protoc

查看最新稳定的protoc版本
https://github.com/google/protobuf/releases

下载
$ wget https://github.com/google/protobuf/releases/download/v3.2.0/protoc-3.2.0-linux-x86_64.zip

安装
$ unzip protoc-3.2.0-linux-x86_64.zip -d protoc-3.2.0
$ cp protoc-3.2.0 /usr/local/ -R

加入系统环境变量
$ export PATH=$PATH:/usr/local/protoc-3.2.0/bin
$ vi /etc/profile

在最后添加下面这一行
#protoc path
export PATH=$PATH:/usr/local/protoc-3.2.0/bin

18.安装Redis

$ yum install -y wget gcc make tcl
$ wget http://download.redis.io/releases/redis-3.2.8.tar.gz
$ tar -zxvf redis-3.2.8.tar.gz
$ cd redis-3.2.8
$ mkdir /usr/local/redis-3.2.8 -p
$ make
$ make install PREFIX=/usr/local/redis-3.2.8

配置

$ cp redis.conf /etc/
$ vim /etc/redis.conf

#记得在redis.conf中修改
daemonize yes

关闭保护模式
protected-mode no

修改默认端口号
port 56379

增加密码,xxxx是密码内容
requirepass xxxx

找到 bind 127.0.0.1 并注释并修改
#bind 127.0.0.1
bind 0.0.0.0

pid文件路径改为
pidfile /var/run/redis.pid

添加redis到系统服务
$ vim /usr/lib/systemd/system/redis.service

写入下面内容:
[Unit]
Description=Redis server
Documentation=https://redis.io/documentation
After=network.target
After=syslog.target

[Service]
Type=forking
PIDFile=/var/run/redis.pid
ExecStart=/usr/local/redis-3.2.8/bin/redis-server /etc/redis.conf
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s QUIT $MAINPID
PrivateTmp=true

[Install]
WantedBy=multi-user.target

将服务添加到开机启动
$ systemctl daemon-reload
$ systemctl start redis
$ systemctl enable redis

19.安装PHP

configure: error: png.h not found.错误的解决方法
$yum install libpng
$yum install libpng-devel

安装PHP过程中make步骤可能出现错误(内存小于1G),解决方法如下

最终成功安装的配置如下,加入了 pdo_mysql 和对gd 的完整支持,注意 freetype为单独编译安装,如果未编译安装,路径应为 /usr/lib64

$ cd /usr/local/src
$ tar -zxvf php-5.6.30.tar.gz
$ cd php-5.6.30
$ mkdir -p /usr/local/php-7.2.4 -p
$ ./configure --prefix=/usr/local/php-7.2.4 --with-config-file-path=/usr/local/php-7.2.4/etc --with-mysql=/usr/local/mysql-5.7.17 --with-mysqli=/usr/local/mysql-5.7.17/bin/mysql_config --with-mysql-sock=/tmp/mysql.sock --with-gd --with-iconv --with-zlib --enable-xml --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --enable-mbregex --enable-fpm --enable-mbstring --enable-ftp --enable-gd-native-ttf --with-openssl --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --with-pear --with-gettext --enable-session --with-mcrypt=/usr/local/libmcrypt-2.5.8 --with-curl=/usr/lib64 --with-freetype-dir=/usr/local/freetype-2.7.1 --with-jpeg-dir=/usr/lib64 --with-png-dir=/usr/lib64 --enable-gd-native-ttf --with-pdo-mysql=/usr/local/mysql-5.7.17 --disable-fileinfo

$ make
$ make install
$ cp php.ini-production /usr/local/php-7.2.4/etc/php.ini
$ rm -f /etc/php.ini
$ ln -s /usr/local/php-7.2.4/etc/php.ini /etc/php.ini
$ cp /usr/local/php-7.2.4/etc/php-fpm.conf.default /usr/local/php-7.2.4/etc/php-fpm.conf
$ vim /usr/local/php-7.2.4/etc/php-fpm.conf

设置 php-fpm运行账号为www
user = www

设置 php-fpm运行组为www
group = www

取消前面的分号
pid = /run/php-fpm.pid

编辑配置文件
$ vi /usr/local/php5/etc/php.ini

修改
date.timezone = PRC #设置时区

添加php-fpm系统服务
$ vim /etc/systemd/system/php-fpm.service

在文件中写入下面内容:
[Unit]
Description=The PHP FastCGI Process Manager
After=syslog.target network.target
Before=nginx.servic

[Service]
Type=forking
PIDFile=/usr/local/php-7.2.4/var/run/php-fpm.pid
ExecStart=/usr/local/php-7.2.4/sbin/php-fpm --fpm-config /usr/local/php-7.2.4/etc/php-fpm.conf
ExecReload=/bin/kill -USR2 $MAINPID
PrivateTmp=true

[Install]
WantedBy=multi-user.target

设置开机启动
$ systemctl start php-fpm
$ systemctl enable php-fpm

加入系统环境变量
$ export PATH=$PATH:/usr/local/php-7.2.4/bin
$ vi /etc/profile

在最后添加下面这一行
#php path
export PATH=$PATH:/usr/local/php-7.2.4/bin

20.配置nginx支持 php

编辑配置文件 ,需做如下修改
$ vi /usr/local/nginx/conf/nginx.conf

首行 user去掉注释, 修改Nginx运行组为 www www
user www www;

必须与 /usr/local/php-5.6.30/etc/php-fpm.conf中的user,group 配置相同,否则 php运行出错

index index.php index.html index.htm; #添加index.php

在http项中增加站点配置目录 (最后一个花括号前增加一行 )
include /usr/local/nginx-1.9.9/conf/vhosts/*.conf;

增加站点目录
$ mkdir /usr/local/nginx-1.9.9/conf/vhosts -p

增加一个默认站点配置
$ vim /usr/local/nginx-1.9.9/conf/vhosts/default.conf

在配置中增加下面内容
server {
listen 80 default_server;

    root /data/www/default/wwwroot;
    index index.html index.htm index.php;

    server_name localhost;

    access_log /data/www/default/logs/access.log;
    error_log /data/www/default/logs/error.log;
    error_page 500 502 503 504 = /50x.html;
    error_page 404 = /404.html;

    location / {
            try_files $uri $uri/ =404;
            if (!-e $request_filename) {
                    rewrite ^/(.*)$ /index.php?s=$1 last;
                     break;
                    
            }
    }

    location ~ \.php$ {
            fastcgi_split_path_info ^(.+\.php)(/.+)$;
            fastcgi_pass 127.0.0.1:9000;
            fastcgi_index index.php;
            include fastcgi_params;
            fastcgi_param  SCRIPT_FILENAME  /data/www/default/wwwroot$fastcgi_script_name;
    }

    location ~ /\.ht {
            deny all;
    }

}

增加站点目录
$ mkdir /data/www
$ mkdir /data/www/default
$ mkdir /data/www/default/logs
$ mkdir /data/www/default/wwwroot

重启 nginx
$ systemctl restart nginx
$ systemctl status nginx

输出:
● nginx.service - nginx - high performance web server
Loaded: loaded (/usr/lib/systemd/system/nginx.service; enabled; vendor preset: disabled)
Active: active (running) since Wed 2017-02-15 01:08:31 EST; 5s ago


21. 安装scws的 PHP 扩展

源码在 phpext下

$ cd /usr/local/src/scws-1.2.3/phpext
$ /usr/local/php-5.6.30/bin/phpize
$ mkdir /usr/local/scws-1.2.3 -p
$ ./configure --with-scws=/usr/local/scws-1.2.3 --with-php-config=/usr/local/php-5.6.30/bin/php-config
$ make
$ make install
编辑PHP配置文件:
$vi /etc/php.ini

在文件结尾增加下面内容:
[scws]
extension = scws.so
scws.default.charset = utf-8
scws.default.fpath = /usr/local/scws-1.2.3/etc
查看
$ /usr/local/php-5.6.30/bin/php -m | grep scws

22.为php增加 protobuf支持

拷贝旧版的php-protobuf.zip包到src目录(由于原项目需要支持proto2,新版本的php扩展无法兼容)

解压代码
$ unzip php-protobuf.zip

安装
$ cd php-protobuf-master
$ /usr/local/php-5.6.30/bin/phpize
$./configure --with-php-config=/usr/local/php-5.6.30/bin/php-config
$ make
$ make install

配置 php支持protobuf
$ vim /etc/php.ini

在最后一行增加下面内容
[protobuf]
extension=protobuf.so

重启服务
$ systemctl restart php-fpm

23.安装PHP的redis扩展

(php7 安装 参考链接: https://blog.csdn.net/jartins/article/details/80371257)

下载源码
$ wget https://github.com/phpredis/phpredis/archive/master.zip -O php-redis.zip
$ unzip php-redis.zip
$ cd phpredis-master/

编译代码
$ /usr/local/php-5.6.30/bin/phpize
$ ./configure --with-php-config=/usr/local/php-5.6.30/bin/php-config
$ make
$ make install

修改php.ini文件
$ vim /etc/php.ini

在结尾加入下面内容:
[redis]
extension=redis.so

重启php-fpm:
$ systemctl restart php-fpm

24 .全局安装composer工具

$ cd /usr/local/src
$ curl -sS https://getcomposer.org/installer | php
$ cp composer.phar /usr/local/bin/composer
$ composer selfupdate

25.安装s-libev

安装依赖
yum install mbedtls mbedtls-devel -y
yum install libsodium libsodium-devel -y

编译安装依赖(ss在编译过程中对下面两个库有版本要求,单独编译一份对应版本使用)
cd /usr/local/src
wget https://github.com/jedisct1/libsodium/releases/download/1.0.11/libsodium-1.0.11 R.tar.gz
tar -zxvf libsodium-1.0.11 .tar.gz
cd libsodium-1.0.11
./configure --prefix=/usr/local/libsodium-1.0.11
make
make install

cd /usr/local/src
wget https://tls.mbed.org/download/mbedtls-2.4.0-gpl.tgz
tar -xvf mbedtls-2.4.0-gpl.tgz
cd mbedtls-2.4.0
make SHARED=1 CFLAGS=-fPIC
make install DESTDIR=/usr/local/mbedtls-2.4.0

用Git下载并更新代码
$ cd /usr/local/src
$ git clone https://github.com/s/s-libev.git
$ cd s-libev
$ git submodule update --init --recursive

$ yum install gettext gcc autoconf libtool automake make asciidoc xmlto udns-devel libev-devel
$ mkdir /usr/local/s-libev-3.0.2 -p
$ ./autogen.sh
$ ./configure --prefix=/usr/local/s-libev-3.0.2 --with-mbedtls=/usr/local/mbedtls-2.4.0/ --with-sodium=/usr/local/libsodium-1.0.11/
$ make
$ make install

增加配置文件
mkdir /usr/local/s-libev-3.0.2/etc -p
cd /usr/local/s-libev-3.0.2/etc

vim ss-local.json

写入下面内容:
{
“server”: “45.78.59.80”,
“server_port”: 52379,
“local_address”: “0.0.0.0”,
“local_port”: 61081,
“password”: “yxn.yxn”,
“method”: “rc4-md5”,
“remarks”: “banwagong”,
“auth”: false,
“timeout”: 5,
“works”: 5
}

vim ss-redir.json

写入下面内容:
{
“server”: “45.78.59.80”,
“server_port”: 52379,
“local_address”: “0.0.0.0”,
“local_port”: 61082,
“password”: “yxn.yxn”,
“method”: “rc4-md5”,
“remarks”: “banwagong”,
“auth”: false,
“timeout”: 5,
“works”: 5
}

增加启动脚本:
cd /usr/local/s-libev-3.0.2/bin
vim sslocal

写入下面内容:
#! /bin/bash
dir=" ( c d " ( cd " (cd"( dirname “${BASH_SOURCE[0]}” )" && pwd )"
action=$1;
lastpid=cat /var/run/s-local.pid
lastss=ps --no-heading $lastpid | wc -l

if [ “ a c t i o n " = " s t a r t " ] ; t h e n i f [ " action" = "start" ]; then if [ " action"="start"];thenif["lastss” = 1 ]; then
echo “Warning: s already run in pid <KaTeX parse error: Expected 'EOF', got '&' at position 161: …ocks-local.log &̲ pid=!
pid= ( ( p i d + 1 ) ) e c h o " R u n n i n g : s h a d o w s o c k s r u n s u c c e s s i n p i d < ((pid+1)) echo "Running: s run success in pid < ((pid+1))echo"Running:shadowsocksrunsuccessinpid<pid>”
fi
elif [ “ a c t i o n " = " s t o p " ] ; t h e n e c h o " S t o p e d : s t o p p i d < action" = "stop" ]; then echo "Stoped: stop pid < action"="stop"];thenecho"Stoped:stoppid<lastpid>”
kill $lastpid
else
echo “start|stop”
fi

执行:
vim ssserver

写入下面内容:
#! /bin/bash
dir=" ( c d " ( cd " (cd"( dirname “${BASH_SOURCE[0]}” )" && pwd )"
action=$1;
lastpid=cat /var/run/s.pid
lastss=ps --no-heading $lastpid | wc -l

if [ “ a c t i o n " = " s t a r t " ] ; t h e n i f [ " action" = "start" ]; then if [ " action"="start"];thenif["lastss” = 1 ]; then
echo “Warning: s already run in pid <KaTeX parse error: Expected 'EOF', got '&' at position 128: …hadowsocks.log &̲ pid=!
pid= ( ( p i d + 1 ) ) e c h o " R u n n i n g : s h a d o w s o c k s r u n s u c c e s s i n p i d < ((pid+1)) echo "Running: s run success in pid < ((pid+1))echo"Running:shadowsocksrunsuccessinpid<pid>”
fi
elif [ “ a c t i o n " = " s t o p " ] ; t h e n e c h o " S t o p e d : s t o p p i d < action" = "stop" ]; then echo "Stoped: stop pid < action"="stop"];thenecho"Stoped:stoppid<lastpid>”
kill $lastpid
else
echo “start|stop”
fi

执行:
vim ssredir

写入下面内容:
#! /bin/bash
dir=" ( c d " ( cd " (cd"( dirname “${BASH_SOURCE[0]}” )" && pwd )"
action=$1;
lastpid=cat /var/run/s-redir.pid
lastss=ps --no-heading $lastpid | wc -l

if [ “ a c t i o n " = " s t a r t " ] ; t h e n i f [ " action" = "start" ]; then if [ " action"="start"];thenif["lastss” = 1 ]; then
echo “Warning: s already run in pid <KaTeX parse error: Expected 'EOF', got '&' at position 164: …ocks-redir.log &̲ pid=!
pid= ( ( p i d + 1 ) ) e c h o " R u n n i n g : s h a d o w s o c k s r u n s u c c e s s i n p i d < ((pid+1)) echo "Running: s run success in pid < ((pid+1))echo"Running:shadowsocksrunsuccessinpid<pid>”
fi
elif [ “ a c t i o n " = " s t o p " ] ; t h e n e c h o " S t o p e d : s t o p p i d < action" = "stop" ]; then echo "Stoped: stop pid < action"="stop"];thenecho"Stoped:stoppid<lastpid>”
kill $lastpid
else
echo “start|stop”
fi

给脚本增加执行权限
chmod 755 sslocal
chmod 755 ssserver
chmod 755 ssredir

加入系统环境变量
$ export PATH=$PATH:/usr/local/s-libev-3.0.2/bin
$ vi /etc/profile

在最后添加下面这一行
#s path
export PATH=$PATH:/usr/local/s-libev-3.0.2/bin

26.安装privoxy(http代理服务)

查找最新版
https://sourceforge.net/projects/ijbswa/files/Sources/

下载源码
wget https://nchc.dl.sourceforge.net/project/ijbswa/Sources/3.0.26 (stable)/privoxy-3.0.26-stable-src.tar.gz

  1. 编译
    $ tar xzvf privoxy-3.0.26-stable-src.tar.gz
    $ cd privoxy-3.0.26-stable
    $ autoheader
    $ autoconf
    $ ./configure --prefix=/usr/local/privoxy-3.0.26
    $ make

4.建立账户
$ sudo useradd privoxy -r -s /usr/sbin/nologin

5.安装
$ sudo make install

7.创建启动脚本
$ vim /usr/lib/systemd/system/privoxy.service

写入内容:
[Unit]
Description=privoxy
After=network.target remote-fs.target nss-lookup.target

[Service]
Type=forking
PIDFile=/var/run/privoxy.pid
ExecStart=/usr/local/privoxy-3.0.26/sbin/privoxy --pidfile /var/run/privoxy.pid --user privoxy /usr/local/privoxy-3.0.26/etc/config
ExecStop=/bin/kill -s QUIT $MAINPID
PrivateTmp=true

[Install]
WantedBy=multi-user.target

9.更改侦听地址
$ vim /usr/local/privoxy-3.0.26/etc/config

将listen-address值更改为 0.0.0.0:8118

找到:
actionsfile user.action # User customizations

在后面一行加入内容:
actionsfile gfwlist.action # Gfw customizations

最后在文件结尾加入:
forward 10.../ .
forward 192.168.
./ .
forward 127.
../ .
forward localhost/ .

新建gfwaction文件:
$ vim /usr/local/privoxy-3.0.26/etc/gfwlist.action

加入内容:
#gfwlist.action 2017-02-16
{+forward-override{forward-socks5 127.0.0.1:61081 .}}

重启
$ systemctl restart privoxy

27.编译安装dnsmasq

dnsmasq最新的下载地址:http://www.thekelleys.org.uk/dnsmasq/

下载最新的dnsmasq:
cd /usr/local/src
wget http://www.thekelleys.org.uk/dnsmasq/dnsmasq-2.76.tar.gz

编译
tar -zxvf dnsmasq-2.76.tar.gz
cd dnsmasq-2.76
make V=s

复制可执行文件到系统目录覆盖原有的dnsmasq
cp ./src/dnsmasq /usr/sbin/

修改配置文件
vim /etc/dnsmasq.conf

找到
#resolv-file=
改为
resolv-file=/etc/resolv.dnsmasq.conf

找到
#listen-address=
改为
listen-address=192.168.8.158,127.0.0.1

找到
#addn-hosts=/etc/banner_add_hosts
改为
addn-hosts=/etc/dnsmasq.hosts

找到
#local-ttl=
改为(这里的时间为缓存一天,可以自己根据实际情况修改)
local-ttl=86400

接着添加其余的配置文件
vim /etc/resolv.dnsmasq.conf

写入下面内容
nameserver 218.85.157.99
nameserver 218.85.152.99

执行
vim /etc/dnsmasq.hosts

写入下面内容
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.8.158 local.dev

将系统的dns服务指向本地:
vim /etc/resolv.conf

改为:
nameserver 192.168.8.158

重启服务:
systemctl restart dnsmasq

28.安装dns转socks代理服务器进行域名解析代理

从git上clone最新的代码
cd /usr/local/src
git clone https://github.com/jtripper/dns-tcp-socks-proxy
cd dns-tcp-socks-proxy/

编译
make
cp -R ./ /usr/local/dns-tcp-socks-proxy-1.0

修改配置文件
cd /usr/local/dns-tcp-socks-proxy-1.0/
vim dns_proxy.conf

找到:
socks_port = 9050
改为:
socks_port = 61081

找到:
listen_port = 53
改为:
listen_port = 60053

找到:
resolv_conf = resolv.conf
改为:
resolv_conf = /usr/local/dns-tcp-socks-proxy-1.0/resolv.conf

修改文件resolv.conf
vim ./resolv.conf

写入下面内容:
8.8.8.8
8.8.4.4
156.154.70.1
156.154.71.1
208.67.222.222
208.67.220.220
198.153.192.1
198.153.194.1
4.2.2.1
4.2.2.2
4.2.2.3
4.2.2.4
4.2.2.5
4.2.2.6
85.88.19.10
85.88.19.11
87.118.100.175
212.82.225.7
212.82.226.212
213.73.91.35
82.229.244.191
66.244.95.20
204.152.184.76
194.150.168.168
80.237.196.2
194.95.202.198
208.67.220.220
208.67.222.222
156.154.70.22
156.154.71.22
8.8.8.8
8.8.4.4
94.75.228.29
202.83.95.227
64.0.55.201
109.69.8.51
8.26.56.26
8.20.247.20
69.164.196.21

将当前路径写入path变量
export PATH=$PATH:/usr/local/dns-tcp-socks-proxy-1.0/

vim /etc/profile

在结尾写入:
#dns_proxy
export PATH=$PATH:/usr/local/dns-tcp-socks-proxy-1.0/

29.编译安装最新的samba服务

yum安装依赖
yum -y install gcc perl python-devel gnutls-devel libacl-devel openldap-devel

在官网查找最新版本
https://www.samba.org/samba/download/

下载源码
wget https://download.samba.org/pub/samba/stable/samba-4.5.5.tar.gz

解压缩并编译
tar -zxvf samba-4.5.5.tar.gz
cd samba-4.5.5
./configure --prefix=/usr/local/samba-4.5.5
make
make install

增加用户
useradd samba
/usr/local/samba-4.5.5/bin/smbpasswd -a samba
输入密码完成

编辑配置文件
cp ./examples/smb.conf.default /usr/local/samba-4.5.5/etc/smb.conf
mkdir /data/samba -p
chown samba:samba /data/samba -R
vim /usr/local/samba-4.5.5/etc/smb.conf

找到:
log file = /usr/local/samba/var/log.%m
改为:
log file = /usr/local/samba-4.5.5/var/log.%m

在结尾加上
[public]
path = /data/samba
public = yes
only guest = no
writable = yes
printable = no

添加到服务:
vim /usr/lib/systemd/system/smbd.service
填写下面内容:
[Unit]
Description=samba
After=network.target remote-fs.target nss-lookup.target

[Service]
Type=forking
PIDFile=/usr/local/samba-4.5.5/var/run/smbd .pid
ExecStart=/usr/local/samba-4.5.5/sbin/smbd
ExecStop=/bin/kill -s QUIT $MAINPID
PrivateTmp=true

[Install]
WantedBy=multi-user.target

重启服务
systemctl start smbd

然后在windows下的文件夹窗口访问当前机器地址:
\192.168.8.158

填写用户名密码后就能登陆近samba服务
试着在public目录下创建一个空的文本文件
然后回到linux中:
ls /data/samba

可以看到多了一个文件:
新建文本文档.txt

安装成功

30.安装迅雷远程下载(Xware)

安装依赖:
yum install redhat-lsb-core
安装32位支持
yum install glibc.i686
yum install zlib.i686

到官网论坛下载最新版固件:
http://luyou.xunlei.com/thread-12545-1-1.html

下载完成后将zip包上传到系统的/usr/local/src目录
开始安装:
mkdir Xware-1.0.31
unzip Xware1.0.31_x86_32_glibc.zip -d ./Xware-1.0.31
cp Xware-1.0.31/ /usr/local/xware-1.0.31 -R
chown thunder:thunder /usr/local/xware-1.0.31 -R

在目录下加入启动脚本
cd /usr/local/xware-1.0.31/
vim thunder

然后进入粘贴模式:set paste
粘贴下面内容:
#! /bin/bash

USER=thunder
XWAREPATH=/usr/local/xware-1.0.31
RUN= X W A R E P A T H / p o r t a l L O G = XWAREPATH/portal LOG= XWAREPATH/portalLOG=XWAREPATH/message.log

PATH=/sbin:/usr/sbin:/bin:/usr/bin
DESC=“Embed Thunder Manager”
NAME=thunder
DAEMON= X W A R E P A T H / l i b / E T M D a e m o n M A N A G E R D A E M O N = XWAREPATH/lib/ETMDaemon MANAGERDAEMON= XWAREPATH/lib/ETMDaemonMANAGERDAEMON=XWAREPATH/lib/EmbedThunderManager
HTTPDAEMON= X W A R E P A T H / l i b / v o d h t t p s e r v e r P I D F I L E = XWAREPATH/lib/vod_httpserver PIDFILE= XWAREPATH/lib/vodhttpserverPIDFILE=XWAREPATH/$NAME.pid

action= 1 ; l a s t p i d = ‘ p s − e f ∣ g r e p " 1; lastpid=`ps -ef | grep " 1;lastpid=psefgrep"DAEMON" | grep -v grep | awk '{print KaTeX parse error: Expected 'EOF', got '}' at position 2: 2}̲'` lasthttppid=…HTTPDAEMON" | grep -v grep | awk '{print KaTeX parse error: Expected 'EOF', got '}' at position 2: 2}̲'` lastmanagerp…MANAGERDAEMON" | grep -v grep | awk '{print $2}'lastdaemon=ps --no-heading $lastpid | wc -l`

if [ “ a c t i o n " = " s t a r t " ] ; t h e n i f [ " action" = "start" ]; then if [ " action"="start"];thenif["lastdaemon” = 1 ]; then
echo “Warning: xware already run in pid <$lastpid>”
else
su U S E R − c " USER -c " USERc"RUN" > L O G 2 > / d e v / n u l l p i d = LOG 2>/dev/null pid= LOG2>/dev/nullpid=!
pid=$((pid+1))

    sleep 5
    pid=`ps -ef | grep "$DAEMON" | grep -v grep | awk '{print $2}'`
    echo "Running: xware running success in pid <$pid>"
    echo $pid > $PIDFILE
fi

elif [ “$action” = “stop” ]; then
echo “daemon: $lastpid”
if [ $lastpid > 0 ]; then
kill $lastpid
fi
echo “manager: $lastmanagerpid”
if [ $lastmanagerpid > 0 ]; then
kill $lastmanagerpid
fi
echo “http: $lasthttppid”
if [ $lasthttppid > 0 ]; then
kill $lasthttppid
fi

echo "Stoped: stop pid <$lastpid>"

elif [ “ a c t i o n " = " s t a t u s " ] ; t h e n i f [ " action" = "status" ]; then if [ " action"="status"];thenif["lastdaemon” = 1 ]; then
echo “daemon: $lastpid”
echo “manager: $lastmanagerpid”
echo “http: l a s t h t t p p i d " e c h o " X w a r e a l r e a d y r u n i n p i d < lasthttppid" echo "Xware already run in pid < lasthttppid"echo"Xwarealreadyruninpid<lastpid>”
else
echo “Xware is not running”
fi
else
echo “{start|stop|status}”
fi

然后修改文件权限:
chmod 755 ./thunder
chown thunder:thunder ./thunder

接下来启动迅雷
sh /usr/local/xware-1.0.31/thunder start
运行后脚本会生成一个远程激活码
保存在文件/usr/local/xware-1.0.31/message.log中
cat /usr/local/xware-1.0.31/message.log
可以看到日志:
initing…
try stopping xunlei service first…
setting xunlei runtime env…
port: 9001 is usable.

YOUR CONTROL PORT IS: 9001

starting xunlei service…
setting xunlei runtime env…
port: 9001 is usable.

YOUR CONTROL PORT IS: 9001

starting xunlei service…

getting xunlei service info…

THE ACTIVE CODE IS: tmtgjz

go to http://yuancheng.xunlei.com, bind your device with the active code.
finished.

其中THE ACTIVE CODE IS: xxxxxx这段就是的的激活码
登陆http://yuancheng.xunlei.com/,选择添加设备进行添加

配置下载目录:
mkdir /data/xware -p
mkdir /mnt/xware -p
mount --bind /data/xware /mnt/xware
chown thunder:thunder /data/xware -R

vim /usr/local/xware-1.0.31/cfg/thunder_mounts.cfg
添加下面内容:
avaliable_mount_path_pattern
{
/mnt/xware
}

第一次启动后会在安装目录下生成配置文件,可以将监听端口等修改防止冲突:
vim /usr/local/xware-1.0.31/cfg/etm.cfg

找到配置:
local_control.listen_port=9001
改为:
local_control.listen_port=59001

将可执行文件加入path目录:
export PATH=$PATH:/usr/local/xware-1.0.31
vi /etc/profile

在最后添加下面这一行
#xware path
export PATH=$PATH:/usr/local/xware-1.0.31

然后重启迅雷
thunder stop
thunder start

最后在http://yuancheng.xunlei.com/页面中尝试下载
如果安装成功,下载的文件将保存在下面目录中:
/data/xware/TDDOWNLOAD/

在/etc/rc.local中加入启动命令开机启动
vim /etc/rc.local

在结尾加入:
#ipset & iptables
ipset create s hash:ip
service iptables restart

#s
export PATH=$PATH:/usr/local/s-libev-3.0.2/bin/
/usr/local/s-libev-3.0.2/bin/sslocal start
/usr/local/s-libev-3.0.2/bin/ssredir start
sleep 3

#dns proxy
export PATH=$PATH:/usr/local/dns-tcp-socks-proxy-1.0/
/usr/local/dns-tcp-socks-proxy-1.0/dns_proxy /usr/local/dns-tcp-socks-proxy-1.0/dns_proxy.conf > /dev/null &

#dnsmasq
systemctl restart dnsmasq

然后给rc.local执行权限
chmod 755 /etc/rc.d/rc.local

(附)
修改系统语言
vim /etc/locale.conf

原:LANG=en_US.utf8
LANG=“zh_CN.UTF-8”

$reboot

你可能感兴趣的:(项目学习)