Linux学习笔记12——配置ftp、squid、Tomcat、Samba、MySQL主从

Linux学习笔记12

配置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

搭好vsftp之后出现553 Could not create file解决方法

mkdir 你的ftp服务器根路径/file
chmod -R 777 你的ftp服务器根路径/file

然后杀死vsftpd进程,killall vsftpd
然后重启vsftpd服务器程序,systemctl restart vsftpd.service
然后使用xftp这类ftp工具登录,将文件上传到file目录下,这个时候就可以正常的上传文件了。



配置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》


  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值