本帖最后由 hazhuer 于 2016-5-8 17:47 编辑
lnmp搭建discuz有什么不对的地方请大家指教
1、安装mysql
2、php编译安装
cd /usr/local/src
wget http://cn2.php.net/distributions/php-5.4.36.tar.bz2
tar jxvf php-5.4.36.tar.bz2
useradd -s /sbin/nologin php-fpm
cd php-5.4.36
./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --enable-fpm --with-fpm-user=php-fpm --with-fpm-group=php-fpm --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-mysql-sock=/tmp/mysql.sock --with-libxml-dir --with-gd --with-jpeg-dir --with-png-dir --with-freetype-dir --with-iconv-dir --with-zlib-dir --with-mcrypt --enable-soap --enable-gd-native-ttf --enable-ftp --enable-mbstring --enable-exif --enable-zend-multibyte --disable-ipv6 --with-pear --with-curl
make
make install
cp php.ini-production /usr/local/php/etc/php.ini
vim /usr/local/php/etc/php-fpm.conf
增加以下内容
保存配置文件,检测示是否有语法错误
/usr/local/php/sbin/php-fpm -t
如显示“test is successful”则说明配置文件无语法错误
拷贝启动脚本
cp /usr/local/src/php-5.4.36/sapi/fpm/init.d.php-fpm /etc/init.d/php-fpmmv /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf
修改启动脚本权限为755
chmod 755 /etc/init.d/php-fpm
加入开机启动
chkconfig --add php-fpm
chkconfig php-fpm on
service php-fpm start
3、nginx安装
cd /usr/local/src
wget http://nginx.org/download/nginx-1.4.4.tar.gz
tar -zxvf nginx-1.4.4.tar.gz
cd nginx-1.4.4
./configure \
--prefix=/usr/local/nginx \
--with-http_realip_module \
--with-http_sub_module \
--with-http_gzip_static_module \
--with-http_stub_status_module \
--with-pcre
make
make install
编写nginx启动脚本并加入服务列表
vim /etc/init.d/nginx写入如下内容:#!/bin/bash
# chkconfig: - 30 21
# description: http service.
# Source Function Library
. /etc/init.d/functions
# Nginx Settings
NGINX_SBIN="/usr/local/nginx/sbin/nginx"
NGINX_CONF="/usr/local/nginx/conf/nginx.conf"
NGINX_PID="/usr/local/nginx/logs/nginx.pid"
RETVAL=0
prog="Nginx"
start() {
echo -n $"Starting $prog: "
mkdir -p /dev/shm/nginx_temp
daemon $NGINX_SBIN -c $NGINX_CONF
RETVAL=$?
echo
return $RETVAL
}
stop() {
echo -n $"Stopping $prog: "
killproc -p $NGINX_PID $NGINX_SBIN -TERM
rm -rf /dev/shm/nginx_temp
RETVAL=$?
echo
return $RETVAL
}
reload(){
echo -n $"Reloading $prog: "
killproc -p $NGINX_PID $NGINX_SBIN -HUP
RETVAL=$?
echo
return $RETVAL
}
restart(){
stop
start
}
configtest(){
$NGINX_SBIN -c $NGINX_CONF -t
return 0
}
case "$1" in
start)
start
;;
stop)
stop
;;
reload)
reload
;;
restart)
restart
;;
configtest)
configtest
;;
*)
echo $"Usage: $0 {start|stop|reload|restart|configtest}"
RETVAL=1
esac
exit $RETVAL
保存后,更改权限
chmod 755 /etc/init.d/nginx
chkconfig --add nginx
chkconfig nginx on
修改nginx的配置
> /usr/local/nginx/conf/nginx.conf
使用>可以把一个文本文档快速清空
vim /usr/local/nginx/conf/nginx.conf
保存后检查是否有语法错误
/usr/local/nginx/sbin/nginx -t
如显示
nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful
则表示没有语法错误在配置文件/usr/local/php/etc/php-fpm.conf中加入
listen.owner = nobody
listen.group = nobody
测试是否解析php文件
创建测试文件
vim /usr/local/nginx/html/2.php
内容如下:
<?php
echo "测试php是否解析";
?>
curl localhost/2.php
测试php是否解析
说明php解析正确
安装discuz
mkdir /data/www
cd /data/www
wget http://download.comsenz.com/DiscuzX/3.2/Discuz_X3.2_SC_GBK.zip
unzip Discuz_X3.2_SC_GBK.zip
mv upload/* ./ 程序会放于upload下,要全部移到www目录下,并删除掉多余的文件
rm -rf readme/ utility/ upload/ Discuz_X3.2_SC_GBK.zip
修改nginx的配置文件
vi /usr/local/nginx/conf/nginx.conf
在后面增加以下内容
include /usr/local/nginx/conf/vhosts/*.conf;
配置nginx的虚拟主机
mkdir /usr/local/nginx/conf/vhosts/
cd /usr/local/nginx/conf/vhosts/
vi default.conf
增加以下内容
创建/tmp/tmp1目录
mkdir /tmp/tmp1
/usr/local/nginx/sbin/nginx -t 检查有无语法错误
/etc/init.d/nginx -s reload 重新加载配置文件
因为vhosts目录下自带了默认的虚拟主机配置文件,访问时候会自动跳转到默认的虚拟主机,为了安全起见我们禁止所有的访问,使其访问我们自己设置的网页。添加default,表示默认主机;路径修改为空目录/tmp/tmp1/;deny all表示禁止所有访问,会报403错误。
如我们有新的网站,则需在/usr/local/nginx/conf/vhosts/目录下新建一个虚拟主机文件
vim test.conf重新加载nginx服务
重新配置/usr/local/php/etc/php-fpm.conf文件
我们需修改三处
vim /usr/local/php/etc/php-fpm.conf
此处的listen要和虚拟主机的fastcgi_pass定义的一样。owner和group 都修改为nobody。
service php-fpm restart
配置本地文件
在电脑
C:\Windows\System32\drivers\etc下的hosts文件,添加下面内容后保存退出。
192.168.0.3 www.xp.com www.xx.com
我们在浏览器上输入网址 www.test.com 这时就会跳转到Discuz!安装界面
cd /data/www/
chown -R php-fpm config data uc_client/data uc_server/data
/usr/local/mysql/bin/mysql
mysql> create database discuz; //创建一个数据库,数据库名为discuz
mysql> grant all on discuz.* to 'test'@'localhost' identified by 'testpassword';
// all:所有的权限,用户:test,密码:testpassword
回原网页,填写数据库名:discuz,数据库用户名:test,数据库密码:testpassword,其他的都默认;管理员admin 密码123456,下一步;安装完成以后,点击最右下角的“您的论坛已完成安装,点此访问”。
vi /usr/local/nginx/conf/vhosts/xp.conf
配置如下
1 server
2
3 {
4
5 listen 80 ;
6 #域名跳转
7 server_name www.xp.com www.xx.com;
8 if ($host != 'www.xp.com' )
9 {
10 rewrite ^/(.*)$ http://www.xp.com/$1 permanent;
11 }
12 index index.html index.htm index.php;
13 root /data/www;
14 #日志
15 access_log /tmp/access_log;
16 #访问控制(全局)黑名单
17 #deny 127.0.0.1;
18 #禁止指定的user_agent
19 if ($http_user_agent ~* 'baidu|111')
20 {
21 return 403;
22 }
23
24 #用户认证,限制访问admin.php,
25 location ~ .*admin\.php {
26 #auth_basic "x";
27 #auth_basic_user_file /usr/local/nginx/conf/htpasswd;
28 #访问控制(局部)白名单
29 allow 127.0.0.1;
30 deny all;
31 include fastcgi_params;
32 fastcgi_pass unix:/tmp/www.sock;
33 #fastcgi_pass 127.0.0.1:9000;
34 fastcgi_index index.php;
35 fastcgi_param SCRIPT_FILENAME /data/www$fastcgi_script_name;
36 }
37 #不记录指定的文件类型文件
38 location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|zip|gz|flv|bz2)$
39 {
40 access_log off;
41 #静态文件过期时间
42 expires 15d;
43 #防盗链
44 valid_referers none blocked *.xp.com *.xiepeng.com *.xieqijing.com *.xx.com;
45 if ($invalid_referer)
46 {
47 #直接显示403
48 return 403;
49 #跳转到我的网站主页上
50 #rewrite ^/http://www.xp.com/nophoto.gif;
51 }
52 }
53 location ~ \.(js|css)
54 {
55 access_log off;
56 #静态文件过期时间
57 expires 2h;
58 }
59 location ~ (static|cache)
60 {
61 access_log off;
62 }
63 location ~ \.php$ {
64 include fastcgi_params;
65 fastcgi_pass unix:/tmp/www.sock;
66 #fastcgi_pass 127.0.0.1:9000;
67 fastcgi_index index.php;
68 fastcgi_param SCRIPT_FILENAME /data/www$fastcgi_script_name;
69 }
70 }
/usr/local/nginx/sbin/nginx -t 检查有无语法错误
/etc/init.d/nginx -s reload 重新加载配置文件
lnmp搭建discuz有什么不对的地方请大家指教
1、安装mysql
2、php编译安装
cd /usr/local/src
wget http://cn2.php.net/distributions/php-5.4.36.tar.bz2
tar jxvf php-5.4.36.tar.bz2
useradd -s /sbin/nologin php-fpm
cd php-5.4.36
./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --enable-fpm --with-fpm-user=php-fpm --with-fpm-group=php-fpm --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-mysql-sock=/tmp/mysql.sock --with-libxml-dir --with-gd --with-jpeg-dir --with-png-dir --with-freetype-dir --with-iconv-dir --with-zlib-dir --with-mcrypt --enable-soap --enable-gd-native-ttf --enable-ftp --enable-mbstring --enable-exif --enable-zend-multibyte --disable-ipv6 --with-pear --with-curl
make
make install
cp php.ini-production /usr/local/php/etc/php.ini
vim /usr/local/php/etc/php-fpm.conf
增加以下内容
- [global]
- pid = /usr/local/php/var/run/php-fpm.pid
- error_log = /usr/local/php/var/log/php-fpm.log
- [www]
- listen = /tmp/php-fcgi.sock 注意nginx.conf中监控方式的一致
- user = php-fpm
- group = php-fpm
- pm = dynamic
- pm.max_children = 50
- pm.start_servers = 20
- pm.min_spare_servers = 5
- pm.max_spare_servers = 35
- pm.max_requests = 500
- rlimit_files = 1024
保存配置文件,检测示是否有语法错误
/usr/local/php/sbin/php-fpm -t
如显示“test is successful”则说明配置文件无语法错误
拷贝启动脚本
cp /usr/local/src/php-5.4.36/sapi/fpm/init.d.php-fpm /etc/init.d/php-fpmmv /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf
修改启动脚本权限为755
chmod 755 /etc/init.d/php-fpm
加入开机启动
chkconfig --add php-fpm
chkconfig php-fpm on
service php-fpm start
3、nginx安装
cd /usr/local/src
wget http://nginx.org/download/nginx-1.4.4.tar.gz
tar -zxvf nginx-1.4.4.tar.gz
cd nginx-1.4.4
./configure \
--prefix=/usr/local/nginx \
--with-http_realip_module \
--with-http_sub_module \
--with-http_gzip_static_module \
--with-http_stub_status_module \
--with-pcre
make
make install
编写nginx启动脚本并加入服务列表
vim /etc/init.d/nginx写入如下内容:
# chkconfig: - 30 21
# description: http service.
# Source Function Library
. /etc/init.d/functions
# Nginx Settings
NGINX_SBIN="/usr/local/nginx/sbin/nginx"
NGINX_CONF="/usr/local/nginx/conf/nginx.conf"
NGINX_PID="/usr/local/nginx/logs/nginx.pid"
RETVAL=0
prog="Nginx"
start() {
echo -n $"Starting $prog: "
mkdir -p /dev/shm/nginx_temp
daemon $NGINX_SBIN -c $NGINX_CONF
RETVAL=$?
echo
return $RETVAL
}
stop() {
echo -n $"Stopping $prog: "
killproc -p $NGINX_PID $NGINX_SBIN -TERM
rm -rf /dev/shm/nginx_temp
RETVAL=$?
echo
return $RETVAL
}
reload(){
echo -n $"Reloading $prog: "
killproc -p $NGINX_PID $NGINX_SBIN -HUP
RETVAL=$?
echo
return $RETVAL
}
restart(){
stop
start
}
configtest(){
$NGINX_SBIN -c $NGINX_CONF -t
return 0
}
case "$1" in
start)
start
;;
stop)
stop
;;
reload)
reload
;;
restart)
restart
;;
configtest)
configtest
;;
*)
echo $"Usage: $0 {start|stop|reload|restart|configtest}"
RETVAL=1
esac
exit $RETVAL
保存后,更改权限
chmod 755 /etc/init.d/nginx
chkconfig --add nginx
chkconfig nginx on
修改nginx的配置
> /usr/local/nginx/conf/nginx.conf
使用>可以把一个文本文档快速清空
vim /usr/local/nginx/conf/nginx.conf
- user nobody nobody;
- worker_processes 2;
- error_log /usr/local/nginx/logs/nginx_error.log crit;
- pid /usr/local/nginx/logs/nginx.pid;
- worker_rlimit_nofile 51200;
- events
- {
- use epoll;
- worker_connections 6000;
- }
- http
- {
- include mime.types;
- default_type application/octet-stream;
- server_names_hash_bucket_size 3526;
- server_names_hash_max_size 4096;
- log_format combined_realip '$remote_addr $http_x_forwarded_for [$time_local]'
- '$host "$request_uri" $status'
- '"$http_referer" "$http_user_agent"';
- sendfile on;
- tcp_nopush on;
- keepalive_timeout 30;
- client_header_timeout 3m;
- client_body_timeout 3m;
- send_timeout 3m;
- connection_pool_size 256;
- client_header_buffer_size 1k;
- large_client_header_buffers 8 4k;
- request_pool_size 4k;
- output_buffers 4 32k;
- postpone_output 1460;
- client_max_body_size 10m;
- client_body_buffer_size 256k;
- client_body_temp_path /usr/local/nginx/client_body_temp;
- proxy_temp_path /usr/local/nginx/proxy_temp;
- fastcgi_temp_path /usr/local/nginx/fastcgi_temp;
- fastcgi_intercept_errors on;
- tcp_nodelay on;
- gzip on;
- gzip_min_length 1k;
- gzip_buffers 4 8k;
- gzip_comp_level 5;
- gzip_http_version 1.1;
- gzip_types text/plain application/x-javascript text/css text/htm application/xml;
- server
- {
- listen 80;
- server_name localhost;
- index index.html index.htm index.php;
- root /usr/local/nginx/html;
- location ~ \.php$ {
- include fastcgi_params;
- fastcgi_pass unix:/tmp/php-fcgi.sock;
- fastcgi_index index.php;
- fastcgi_param SCRIPT_FILENAME /usr/local/nginx/html$fastcgi_script_name;
- }
- }
- }
/usr/local/nginx/sbin/nginx -t
如显示
nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful
则表示没有语法错误在配置文件/usr/local/php/etc/php-fpm.conf中加入
listen.owner = nobody
listen.group = nobody
测试是否解析php文件
创建测试文件
vim /usr/local/nginx/html/2.php
内容如下:
<?php
echo "测试php是否解析";
?>
curl localhost/2.php
测试php是否解析
说明php解析正确
安装discuz
mkdir /data/www
cd /data/www
wget http://download.comsenz.com/DiscuzX/3.2/Discuz_X3.2_SC_GBK.zip
unzip Discuz_X3.2_SC_GBK.zip
mv upload/* ./ 程序会放于upload下,要全部移到www目录下,并删除掉多余的文件
rm -rf readme/ utility/ upload/ Discuz_X3.2_SC_GBK.zip
修改nginx的配置文件
vi /usr/local/nginx/conf/nginx.conf
在后面增加以下内容
include /usr/local/nginx/conf/vhosts/*.conf;
配置nginx的虚拟主机
mkdir /usr/local/nginx/conf/vhosts/
cd /usr/local/nginx/conf/vhosts/
vi default.conf
增加以下内容
- server {
- listen 80 default_server;
- server_name 123.com;
- index index.html index.htm index.php;
- root /tmp/tmp1;
- deny all;
- }
创建/tmp/tmp1目录
mkdir /tmp/tmp1
/usr/local/nginx/sbin/nginx -t 检查有无语法错误
/etc/init.d/nginx -s reload 重新加载配置文件
因为vhosts目录下自带了默认的虚拟主机配置文件,访问时候会自动跳转到默认的虚拟主机,为了安全起见我们禁止所有的访问,使其访问我们自己设置的网页。添加default,表示默认主机;路径修改为空目录/tmp/tmp1/;deny all表示禁止所有访问,会报403错误。
如我们有新的网站,则需在/usr/local/nginx/conf/vhosts/目录下新建一个虚拟主机文件
vim test.conf
- server
- {
- listen 80;
- server_name www.test.com;
- index index.html index.htm index.php;
- root /data/www;
- location ~ \.php$ {
- include fastcgi_params;
- fastcgi_pass unix:/tmp/php-fcgi.soc;
- # fastcgi_pass 127.0.0.1:9000;
- fastcgi_index index.php;
- fastcgi_param SCRIPT_FILENAME /data/www$fastcgi_script_name;
- }
- }
重新配置/usr/local/php/etc/php-fpm.conf文件
我们需修改三处
vim /usr/local/php/etc/php-fpm.conf
- [global]
- pid = /usr/local/php/var/run/php-fpm.pid
- error_log = /usr/local/php/var/log/php-fpm.log
- [www]
- listen = /tmp/php-fcgi.sock
- listen.owner = nobody
- listen.group = nobody
- user = php-fpm
- group = php-fpm
- listen.owner = nobady
- listen.group = nobady
- pm = dynamic
- pm.max_children = 50
- pm.start_servers = 20
- pm.min_spare_servers = 5
- pm.max_spare_servers = 35
- pm.max_requests = 500
- rlimit_files = 1024
重新加载php服务
service php-fpm restart
配置本地文件
在电脑
C:\Windows\System32\drivers\etc下的hosts文件,添加下面内容后保存退出。
192.168.0.3 www.xp.com www.xx.com
我们在浏览器上输入网址 www.test.com 这时就会跳转到Discuz!安装界面
cd /data/www/
chown -R php-fpm config data uc_client/data uc_server/data
/usr/local/mysql/bin/mysql
mysql> create database discuz; //创建一个数据库,数据库名为discuz
mysql> grant all on discuz.* to 'test'@'localhost' identified by 'testpassword';
// all:所有的权限,用户:test,密码:testpassword
回原网页,填写数据库名:discuz,数据库用户名:test,数据库密码:testpassword,其他的都默认;管理员admin 密码123456,下一步;安装完成以后,点击最右下角的“您的论坛已完成安装,点此访问”。
vi /usr/local/nginx/conf/vhosts/xp.conf
配置如下
1 server
2
3 {
4
5 listen 80 ;
6 #域名跳转
7 server_name www.xp.com www.xx.com;
8 if ($host != 'www.xp.com' )
9 {
10 rewrite ^/(.*)$ http://www.xp.com/$1 permanent;
11 }
12 index index.html index.htm index.php;
13 root /data/www;
14 #日志
15 access_log /tmp/access_log;
16 #访问控制(全局)黑名单
17 #deny 127.0.0.1;
18 #禁止指定的user_agent
19 if ($http_user_agent ~* 'baidu|111')
20 {
21 return 403;
22 }
23
24 #用户认证,限制访问admin.php,
25 location ~ .*admin\.php {
26 #auth_basic "x";
27 #auth_basic_user_file /usr/local/nginx/conf/htpasswd;
28 #访问控制(局部)白名单
29 allow 127.0.0.1;
30 deny all;
31 include fastcgi_params;
32 fastcgi_pass unix:/tmp/www.sock;
33 #fastcgi_pass 127.0.0.1:9000;
34 fastcgi_index index.php;
35 fastcgi_param SCRIPT_FILENAME /data/www$fastcgi_script_name;
36 }
37 #不记录指定的文件类型文件
38 location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|zip|gz|flv|bz2)$
39 {
40 access_log off;
41 #静态文件过期时间
42 expires 15d;
43 #防盗链
44 valid_referers none blocked *.xp.com *.xiepeng.com *.xieqijing.com *.xx.com;
45 if ($invalid_referer)
46 {
47 #直接显示403
48 return 403;
49 #跳转到我的网站主页上
50 #rewrite ^/http://www.xp.com/nophoto.gif;
51 }
52 }
53 location ~ \.(js|css)
54 {
55 access_log off;
56 #静态文件过期时间
57 expires 2h;
58 }
59 location ~ (static|cache)
60 {
61 access_log off;
62 }
63 location ~ \.php$ {
64 include fastcgi_params;
65 fastcgi_pass unix:/tmp/www.sock;
66 #fastcgi_pass 127.0.0.1:9000;
67 fastcgi_index index.php;
68 fastcgi_param SCRIPT_FILENAME /data/www$fastcgi_script_name;
69 }
70 }
/usr/local/nginx/sbin/nginx -t 检查有无语法错误
/etc/init.d/nginx -s reload 重新加载配置文件
0
1). yum -y install vsftpd db4-utils
2). 建立系统账号
useradd virftp -s /sbin/nologin
3). 建立虚拟账户
vim /etc/vsftpd/vsftpd_login
test
1234567
4). 更改权限
chmod 600 /etc/vsftpd/vsftpd_login
5). 生成库文件密码
db_load -T -t hash -f /etc/vsftpd/vsftpd_login /etc/vsftpd/vsftpd_login.db
6). mkdir /etc/vsftpd/vsftpd_user_conf
cd /etc/vsftpd/vsftpd_user_conf
7). 创建和用户对应 的配置文件
vim test
local_root=/home/virftp/test
anonymous_enable=NO
write_enable=YES
local_umask=022
anon_upload_enable=NO
anon_mkdir_write_enable=NO
idle_session_timeout=600
data_connection_timeout=120
max_clients=10
max_per_ip=5
local_max_rate=50000
8). mkdir /home/virftp/test
chown -R virftp:virftp /home/virftp
9). vim /etc/pam.d/vsftpd (添加一下两行)
auth sufficient /lib64/security/pam_userdb.so db=/etc/vsftpd/vsftpd_login
account sufficient /lib64/security/pam_userdb.so db=/etc/vsftpd/vsftpd_login
注:注释掉其他的
10). 修改全局配置文件/etc/vsftpd/vsftpd.conf
anonymous_enable=NO
anon_upload_enable=NO
anon_mkdir_write_enable=NO
添加:
chroot_local_user=YES (可能已经存在)
guest_enable=YES
guest_username=virftp
virtual_use_local_privs=YES
user_config_dir=/etc/vsftpd/vsftpd_user_conf
11). 启动vsftpd 服务
/etc/init.d/vsftpd start
若没有启动成功, killall -9 pure-ftpd
客户端安装 yum -y install ftp
2). 建立系统账号
useradd virftp -s /sbin/nologin
3). 建立虚拟账户
vim /etc/vsftpd/vsftpd_login
test
1234567
4). 更改权限
chmod 600 /etc/vsftpd/vsftpd_login
5). 生成库文件密码
db_load -T -t hash -f /etc/vsftpd/vsftpd_login /etc/vsftpd/vsftpd_login.db
6). mkdir /etc/vsftpd/vsftpd_user_conf
cd /etc/vsftpd/vsftpd_user_conf
7). 创建和用户对应 的配置文件
vim test
local_root=/home/virftp/test
anonymous_enable=NO
write_enable=YES
local_umask=022
anon_upload_enable=NO
anon_mkdir_write_enable=NO
idle_session_timeout=600
data_connection_timeout=120
max_clients=10
max_per_ip=5
local_max_rate=50000
8). mkdir /home/virftp/test
chown -R virftp:virftp /home/virftp
9). vim /etc/pam.d/vsftpd (添加一下两行)
auth sufficient /lib64/security/pam_userdb.so db=/etc/vsftpd/vsftpd_login
account sufficient /lib64/security/pam_userdb.so db=/etc/vsftpd/vsftpd_login
注:注释掉其他的
10). 修改全局配置文件/etc/vsftpd/vsftpd.conf
anonymous_enable=NO
anon_upload_enable=NO
anon_mkdir_write_enable=NO
添加:
chroot_local_user=YES (可能已经存在)
guest_enable=YES
guest_username=virftp
virtual_use_local_privs=YES
user_config_dir=/etc/vsftpd/vsftpd_user_conf
11). 启动vsftpd 服务
/etc/init.d/vsftpd start
若没有启动成功, killall -9 pure-ftpd
客户端安装 yum -y install ftp
0
本帖最后由 hazhuer 于 2016-5-8 14:41 编辑
mysql主从进入mysql的安装目录
[root@VM_65_251_centos ~]# cd /usr/local/
复制并从命名
[root@VM_65_251_centos local]# cp -r mysql mysql_slave
[root@VM_65_251_centos local]# cd mysql_slave/
复制mysql配置文件到当前目录
[root@VM_65_251_centos mysql_slave]# cp /etc/my.cnf .
编辑/usr/local/mysql_slave/my.cnf
[root@VM_65_251_centos mysql_slave]# vi my.cnf
修改
[mysqld]
port = 3306
socket = /tmp/mysql.sock
为
[mysqld]
port = 3307
socket = /tmp/mysql_slave.sock
添加
datadir = /data/mysql_slave
初始化mysql_slave
[root@VM_65_251_centos mysql_slave]# ./scripts/mysql_install_db --user=mysql --datadir=/data/mysql_slave
如有2个OK表示安装成功
编写启动脚本
[root@VM_65_251_centos mysql_slave]# cd /etc/init.d/
[root@VM_65_251_centos init.d]# cp mysqld mysqldslave
[root@VM_65_251_centos init.d]# vi !$
修改
basedir=/usr/local/mysql
datadir=/data/mysql
为
basedir=/usr/local/mysql_slave
datadir=/data/mysql_slave
conf=$basedir/my.cnf
启动mysql_slave
[root@VM_65_251_centos init.d]# /etc/init.d/mysqldslave start
Starting MySQL. SUCCESS!
通过netstart -lnp查看可以发现有2个数据库在运行
[root@VM_65_251_centos init.d]# netstat -lnp |grep mysql
tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 13706/mysqld
tcp 0 0 0.0.0.0:3307 0.0.0.0:* LISTEN 13541/mysqld
unix 2 [ ACC ] STREAM LISTENING 4393549 13541/mysqld /tmp/mysql_slave.sock
unix 2 [ ACC ] STREAM LISTENING 4394408 13706/mysqld /tmp/mysql.sock
mysql主从进入mysql的安装目录
[root@VM_65_251_centos ~]# cd /usr/local/
复制并从命名
[root@VM_65_251_centos local]# cp -r mysql mysql_slave
[root@VM_65_251_centos local]# cd mysql_slave/
复制mysql配置文件到当前目录
[root@VM_65_251_centos mysql_slave]# cp /etc/my.cnf .
编辑/usr/local/mysql_slave/my.cnf
[root@VM_65_251_centos mysql_slave]# vi my.cnf
修改
[mysqld]
port = 3306
socket = /tmp/mysql.sock
为
[mysqld]
port = 3307
socket = /tmp/mysql_slave.sock
添加
datadir = /data/mysql_slave
初始化mysql_slave
[root@VM_65_251_centos mysql_slave]# ./scripts/mysql_install_db --user=mysql --datadir=/data/mysql_slave
如有2个OK表示安装成功
编写启动脚本
[root@VM_65_251_centos mysql_slave]# cd /etc/init.d/
[root@VM_65_251_centos init.d]# cp mysqld mysqldslave
[root@VM_65_251_centos init.d]# vi !$
修改
basedir=/usr/local/mysql
datadir=/data/mysql
为
basedir=/usr/local/mysql_slave
datadir=/data/mysql_slave
conf=$basedir/my.cnf
启动mysql_slave
[root@VM_65_251_centos init.d]# /etc/init.d/mysqldslave start
Starting MySQL. SUCCESS!
通过netstart -lnp查看可以发现有2个数据库在运行
[root@VM_65_251_centos init.d]# netstat -lnp |grep mysql
tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 13706/mysqld
tcp 0 0 0.0.0.0:3307 0.0.0.0:* LISTEN 13541/mysqld
unix 2 [ ACC ] STREAM LISTENING 4393549 13541/mysqld /tmp/mysql_slave.sock
unix 2 [ ACC ] STREAM LISTENING 4394408 13706/mysqld /tmp/mysql.sock
编辑回复