Linux学习笔记12

Linux学习笔记12

  • Linux学习笔记12
    • 配置FTP服务
      • 配置pure-ftpd
        • 开机启动
        • 上传下载文件
      • 配置vsftpd
        • CentOS 70安装配置Vsftp服务器
    • 配置Squid服务
      • 出现错误acl manager proto cache_object
      • 出现错误FATAL Failed to make swap directory
    • 配置Tomcat
      • 配置JDK
    • 配置Samba服务器
      • centos7将安全等级设置为share报错
      • Linux访问Samba出现NT_status_host_unreachable
    • MySQL replication主从配置
      • kill第二个mysql进程
      • 设置开机第二个启动mysql

配置FTP服务

http://www.apelearn.com/study_v2/chapter21.html#ftp

配置pure-ftpd

开机启动

vim /etc/rc.local

/usr/local/pureftpd/sbin/pure-config.pl /usr/local/pureftpd/etc/pure-ftpd.conf启动命令添加进去。

上传,下载文件

put 文件路径

get 文件路径

帮助信息

?

配置vsftpd

yum install -y vsftpd db4-utils

建立虚拟账号相关联的系统账号 useradd virftp -s /sbin/nologin

建立虚拟账户相关的文件 vim /etc/vsftpd/vsftpd_login

内容如下:

test1
123456
test2
abcdef

chmod 600 /etc/vsftpd/vsftpd_login

生成对应的库文件 db_load -T -t hash -f /etc/vsftpd/vsftpd_login /etc/vsftpd/vsftpd_login.db

建立虚拟账号相关的目录以及配置文件 mkdir /etc/vsftpd/vsftpd_user_conf

cd /etc/vsftpd/vsftpd_user_conf

创建和用户对应的配置文件 vim test1

内容如下:

local_root=/home/virftp/test1
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

mkdir /home/virftp/test1

修改权限: chown -R virftp:virftp /home/virftp/test1

vim /etc/pam.d/vsftpd

在最开头添加两行

auth sufficient /lib/security/pam_userdb.so db=/etc/vsftpd/vsftpd_login
account sufficient /lib/security/pam_userdb.so db=/etc/vsftpd/vsftpd_login

再修改vim /etc/vsftpd/vsftpd.conf

anonymous_enable=YES改为anonymous_enable=NO
#anon_upload_enable=YES 改为 anon_upload_enable=NO
#anon_mkdir_write_enable=YES 改为 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

启动vsftpd服务service vsftpd start

CentOS 7.0安装配置Vsftp服务器

http://www.osyunwei.com/archives/9006.html

配置Squid服务

http://www.apelearn.com/study_v2/chapter22.html#squid

出现错误acl manager proto cache_object

错误代码:

ACL 'manager' already exists with different type.
FATAL: Bungled squid.conf line 6: acl manager proto cache_object

解决方式:删除acl manager proto cache_object这行。

出现错误FATAL: Failed to make swap directory

错误代码:

FATAL: Failed to make swap directory /data/squid/cache/00: (13) Permission denied

解决方式:chown squid:squid /data/squid/cache/

我的squid正向代理配置

http_port 3128
visible_hostname switch.localdomain
acl localnet src 10.0.0.0/8 # RFC1918 possible internal network
acl localnet src 172.16.0.0/12 # RFC1918 possible internal network
acl localnet src 192.168.0.0/16 # RFC1918 possible internal network
acl SSL_ports port 443
acl Safe_ports port 80 8080 # http
acl Safe_ports port 21 # ftp
acl Safe_ports port 443 # https
acl CONNECT method CONNECT
http_access allow manager localhost
http_access deny manager
http_access deny !Safe_ports
http_access deny CONNECT !SSL_ports
http_access allow localnet
http_access allow localhost
http_access allow all
cache_dir aufs /data/squid/cache 1024 16 256
cache_mem 1024 MB
cache_swap_log /var/log/squid/swap.log squid
hierarchy_stoplist cgi-bin ?
coredump_dir /var/spool/squid
refresh_pattern ^ftp: 1440 20% 10080
refresh_pattern ^gopher: 1440 0% 1440
refresh_pattern -i (/cgi-bin/|\?) 0 0% 0
refresh_pattern \.(jpg|png|gif|mp3|xml) 1440 50% 2880 ignore-reload
refresh_pattern . 0 20% 4320

我的squid反向代理

http_port 80 accel vhost vport
cache_peer 101.226.103.106 parent 80 0 originserver name=a
cache_peer 61.135.169.125 parent 80 0 originserver name=b
cache_peer_domain a www.qq.com
cache_peer_domain b www.baidu.com
visible_hostname switch.localdomain
acl localnet src 10.0.0.0/8 # RFC1918 possible internal network
acl localnet src 172.16.0.0/12 # RFC1918 possible internal network
acl localnet src 192.168.0.0/16 # RFC1918 possible internal network
acl SSL_ports port 443
acl Safe_ports port 80 8080 # http
acl Safe_ports port 21 # ftp
acl Safe_ports port 443 # https
acl CONNECT method CONNECT
http_access allow manager localhost
http_access deny manager
http_access deny !Safe_ports
http_access deny CONNECT !SSL_ports
http_access allow localnet
http_access allow localhost
http_access allow all
cache_dir aufs /data/squid/cache 1024 16 256
cache_mem 128 MB
cache_swap_log /var/log/squid/swap.log squid
hierarchy_stoplist cgi-bin ?
coredump_dir /var/spool/squid
refresh_pattern ^ftp: 1440 20% 10080
refresh_pattern ^gopher: 1440 0% 1440
refresh_pattern -i (/cgi-bin/|\?) 0 0% 0
refresh_pattern \.(jpg|png|gif|mp3|xml) 1440 50% 2880 ignore-reload
refresh_pattern . 0 20% 4320

配置Tomcat

http://www.apelearn.com/study_v2/chapter23.html#tomcat

配置JDK

JDK官方下载地址

配置Samba服务器

http://www.apelearn.com/study_v2/chapter24.html#samba

centos7将安全等级设置为share报错

解决办法是不设置成share等级。

Linux访问Samba出现NT_status_host_unreachable

将selinux和iptables关掉。

MySQL replication(主从)配置

http://www.apelearn.com/study_v2/chapter25.html#mysql-replication

kill第二个mysql进程

ps aux | grep mysql2.sock | grep -v grep | awk '{print $2}' | xargs kill

设置开机第二个启动mysql

echo "cd /usr/local/mysql_2/bin/; ./mysqld_safe --defaults-file=../my.cnf --user=mysql &" >>/etc/rc.d/rc.local

参考《跟阿铭学Linux》

你可能感兴趣的:(tomcat,ftp,samba,squid,mysql主从配置)