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/

tomcat中JDK安装

cd  /usr/local   /src

wget http://download.oracle.com/otn-pub/java/jdk/8u71-b15/jdk-8u71-linux-i586.tar.gz?AuthParam=1453344356_d6dd4d01d8d013613bfb060820e7e4be

  tar zxvf jdk-8u71-linux-i586.tar.gz\?AuthParam\=1453344356_d6dd4d01d8d013613bfb060820e7e4be

 mv jdk1.8.0_71 /usr/local/jdk1.8.0_71

 # vim /etc/profile.d/java.sh

JAVA_HOME=/usr/local/jdk1.8.0_71

JAVA_BIN=/usr/local/jdk1.8.0_71/bin

JRE_HOME=/usr/local/jdk1.8.0_71/jre PATH=$PATH:/usr/local/jdk1.8.0_71/bin:/usr/local/jdk1.8.0_71/jre/bin CLASSPATH=/usr/local/jdk1.8.0_71/jre/lib:/usr/local/jdk1.8.0_71/lib:/usr/local/jdk1.8.0_71/jre/lib/charsets.jar

ls /usr/local/jdk1.8.0_71/       查看有没有这个文件

source /etc/profile.d/java.sh

java -version

| 2.4 tomcat安装

 cd /usr/local/src

wgat http://mirror.bit.edu.cn/apache/tomcat/tomcat-7/v7.0.67/bin/apache-tomcat-7.0.67.tar.gz
tar zxvf apache-tomcat-7.0.67.tar.gz

cp -pv /usr/local/tomcat/bin/catalina.sh /etc/init.d/tomcat

 vim /etc/init.d/tomcat

从第二行加如下配置:

 # chkconfig: 2345 63 37

 # description: tomcat server init script

# Source Function Library
. /etc/init.d/functions

 JAVA_HOME=/usr/local/jdk1.8.0_71

 CATALINA_HOME=/usr/local/tomcat

保存该文件,然后把tomcat加入服务列表里面。

# chmod 755 /etc/init.d/tomcat

 # chkconfig --add tomcat

 # chkconfig tomcat on # service tomcat start

# ps aux |grep tomcat 浏览器输入http://ip:8080可以看到tomcat的欢迎页

 tomcat配置和优化

cd /usr/local/tomcat/conf/

ls

vim server.xml

 找到下一行插入新的内容如下:

 

unpackWARs="false" autoDeploy="true" xmlValidation="false" xmlNamespaceAware="false">

service tomcat stop

# service tomcat start

 curl -xlocalhost:80 www.123.com/111.jsp
下面测试jsp解析 # vim /data/tomcatweb/111.jsp

 

Now time is: <%=new java.util.Date()%>

 

curl -xlocalhost:80 www.111.com/111.jsp

 2.6 resin安装与配置

http://caucho.com/products/resin/download/gpl#download

cd /usr/local/src/
 wget http://caucho.com/download/resin-4.0.47.tar.gz
tar zxvf resin-4.0.47.tar.gz
cd resin-4.0.47

 ./configure --prefix=/usr/local/resin --with-java-home=/usr/local/jdk1.8.0_71

 make

make install

etc/init.d/resin start

ps aux |grep resin

ps aux |grep java

  vim resin.properties  

修改监听端口  app  8080

 vim resin.xml  修改配置



 netstat -lnp |grep java

vim /tmp/123/111.jsp 加入如下内容

 Now time is: <%=new java.util.Date()%>

curl -x127.0.0.1:8080 www.123.com/111.jsp

  mysql主从配置-1

cd /usr/local/src/

 tar zxvf mysql-5.1.73-linux-i686-glibc23.tar.gz
mv mysql-5.1.73-linux-i686-glibc23 /usr/local/mysql
grep 'mysql' /etc/passwd

useradd -s /sbin/nologin mysql
cd /usr/local/mysql/

vim /etc/my.cnf

cp support-files//my-small.cnf /etc/my.cnf

cp support-files/mysql.server /etc/init.d/mysqld
vim !$                                                            编辑

basedir= /usr/local/mysql                            添加

datadir=/data/mysql                                     添加

rm -rf /daa/mysql

./scripts/mysql_install_db --user=mysql --datadir=/data/mysql

 ls /data/mysql/

 /etc/init.d/mysqld start

netstart -lnp |grep mysql

/etc/init.d/mysqldslave start

ps aux |grep mysql
netstat -lnp |grep mysql

cd ..

cp -r mysql mysql_slave

cd mysql_slave/

cp /etc/my.cnf  .
pwd

vim my.cnf                                                      编辑修改

port = 3307                                                    修改

socket  = /tmp/mysql_sock.sock                 修改

datadir = /data/mysql_slave                        添加 

./scripts/mysql_install_db --user=mysql --datadir=/data/mysql_slave

 ls /data/mysql_slave/                                    检查

cd /etc/init.d/

cp mysqld mysqldslave
vim !$
basedir= /us/local/mysql_slave                     修改 

datadir = /data/mysq_slave                           修改

conf=$basedir/my.cnf                                     添加

 conf=$basedir/my.cnf                                   修改
/etc/init.d/mysqldslave start
netstat  -lnp |grep mysql

 mysql主从配置-2

mysql
quit
which mysql
create database db1;
quit
mysqldump -S /tmp/mysql.sock mysql > 123.sql
vim 123.sql
mysql -S /tmp/mysql.sock db1 < 123.sql

mysql
 use db1;
show tables;
mysql -S /tmp/mysql_slave.sock  从
vim /etc/my.cnf
server-id   =1     打开
log-bin= aming  打开
binlog-do-db=db1
binlog-ignore-db=mysql 不加 mysql不能通过其他都可通过
/etc/init.d/mysqld restart
ls /data/mysql/
mysql
grant replication slave on *.* to 'repl'@'127.0.0.1' identified by '123123';
flush privileges;
flush tables with read lock;
show master status;

vim /usr/local/mysql_slave/my.cnf
server-id =111
ls
mysql -S /tmp/mysql_slave.sock -e "create database db1"
mysql -S /tmp/mysql_slave.sock db1 <123.sql
mysql -S /tmp/mysql_slave.sock
slave stop ;
change master to master_host='127.0.0.1'master_port=3306,master_user='repl', master_password='123123', master_log_file='aming.000001', master_log_pos=106;
slave start;
show slave status\G;
slave stop ;
/etc/init.d/mysqldslave rstart

 mysql主从配置-3

unlock tables;

drop table help_category;

mysql -S /tmp/mysql_slave.sock

use db1;

show tables;

3.0 dns介绍

 dns安装配置-1

yum list |grep bind

yum install -y bind

vim /etc/named.conf

cat /var/named/named.localhost

cat /etc/named.conf
cat /etc/named.rfc1912.zones
/etc/init.d/named  start

cat /var/named/named.loopback

dig @127.0.0.1 -x 127.0.0.1

 3.2 dns安装配置-2

 cp /etc/named.conf /etc/named.conf.bak

 

  dns安装配置-3

vim /etc/named.conf

/etc/init.d/named start

ls /var/named/slaves/

  腾讯企业邮箱免费版

iredmail安装