Linux常用服务部署与优化

NFS部署和优化-1

 yum install -y nfs-utils rpcbind

vim /etc/exports          写入如下内容:

 /home/ 192.168.0.0/24(rw,sync,all_squash,anonuid=501,anongid=501) 

/etc/init.d/rpcbind  start
/etc/init.d/nfs start
showmount -e 192.168.0.10

umount /opt/

mount -t nfs -o nfsvers=3 192.168.1.111:/mnt /opt

 

df -h

cd /opt/

ls -l

 pureftp部署和优化-1

cd /usr/local/src/

wget  http://down1.chinaunix.net/distfiles/pure-ftpd-1.0.21.tar.bz2
tar jxvf pure-ftpd-1.0.21.tar.bz2

 ./configure \
--prefix=/usr/local/pureftpd \
--without-inetd \
--with-altlog \
--with-puredb \
--with-throttling \
--with-peruserlimits \
--with-tls        

make

make instsll

cd configuration-file

mkdir -p /usr/local/pureftpd/etc/

cp pure-ftpd.conf /usr/local/pureftpd/etc/pure-ftpd.conf

cp pure-config.pl /usr/local/pureftpd/sbin/pure-config.pl

 chmod 755 /usr/local/pureftpd/sbin/pure-config.pl

 vim /usr/local/pureftpd/etc/pure-ftpd.conf

vim /usr/local/pureftpd/etc/pure-ftpd.conf

tail /etc/passwd

chown  -R user3 /tmp/ftp

/usr/local/pureftpd/bin/pure-pw useradd ftpuserl -uuser3 -d /tmp/ftp/

/usr/local/pureftpd/bin/pure-pw mkdb
/usr/local/pureftpd/bin/pure-pw list
/usr/local/pureftpd/bin/pure-pw  userdel
/usr/local/pureftpd/sbin/pure-config.pl  /usr/local/pureftpd/etc/pure-ftpd.conf

pureftp部署和优化-2

yum install -y lftp

lftp [email protected]

vsftp部署和优化-1

 yum -y install vsftpd

killall pure-ftpd

/etc/init.d/vsftpd start

 vim  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服务 # /etc/init.d/vsftpd start

 vsftp部署和优化-2

 

 samba 部署和优化-1

 yum install -y samba samba-client        安装

 vim   /etc/samba/smb.conf                              Samba的配置文件

samba 部署和优化-2

 vim  /etc/samba/smb.conf

 MYGROUP 改成: WORKGROUP,把:security = user 修改为: security = share。

在末尾添加

  comment = share all

path = /tmp/samba

browseable = yes

public = yes

 writable = no

 mkdir /tmp/sambadir

# chmod 777 /tmp/samba

# touch /tmp/samba/sharefiles

# echo "111111" > /tmp/samba/sharefiles

启动samba服务: # /etc/init.d/smb start

会出现无权限访问请联系管理员

 那么就关闭防火墙 iptables -F  

geteforce  查看当前状态   Enforcing

setenforce 0

SELINUX几种状态表示:
enforcing:强制模式,代表 SELinux 运行中,且已经正确的开始限制 domain/type 了;
permissive:宽容模式:代表 SELinux 运行中,不过仅会有警告信息并不会实际限制 domain/type 的存取。这种模式可以运来作为 SELinux 的 debug 之用;
disabled:关闭,SELinux 并没有实际运行。
解决方法二:
更改selinux的策略
chcon -t samba_share_t 共享目录(/var/www/html)

yum install -y cifs-utils
mount -t cifs //192.168.1.111/aming /opt/
cd opt/

samba 部署和优化-3

vim  /

[myshare]

comment = share for users
path = /samba
browseable = yes

writable = yes

public = no

pdbedit -a smbuser1   创建一个用户  

smbclient -Usmbuser1 //192.168.1.111/aminglinux
mount -t cifs //192.168.1.111/aminglinux /opt -o username=smbuser1,password=123456

 squid服务介绍

 squid正向代理

yum install -y squid

vim /etc/squid/squid.conf
refresh_pattern \.(jpg|png|gif|mp3|xml) 1440 50% 2880 ignore-reload refresh_pattern . 0 20% 4320

squid -kcheck                           检测语法错误・

ps aux |grep squid

tcpdump -nn port 3128
# curl -xlocalhost:3128 http://www.baidu.com/

 squid反向代理

vim /etc/squid/squid.conf

http_port 3128 改为: http_port 80 accel vhost vport

然后再增加你要代理的后端真实服务器信息:

cache_peer 180.97.33.108 parent 80 0 originserver name=a

cache_peer 101.226.103.106 parent 80 0 originserver name=b

 cache_peer_domain a www.qq.com

cache_peer_domain b www.baidu.com

cache_peer 192.168.10.111 parent 80 0 originserver

# /etc/init.d/squid restart

 # curl -xlocalhost:80 http://www.baidu.com/

# curl -xlocalhost:80 http://www.qq.com/

# curl -xlocalhost:80 http://www.sina.com/

 

你可能感兴趣的:(linux)