1. CentOS7.0通过yum安装7z

yum install -y p7zip

使用说明:
安装完成后的使用方法:
7za {a|d|l|e|u|x} 压缩包文件名 {文件列表或目录,可选}

a  向压缩包里添加文件或创建压缩包,如向001.7z添加001.jpg,执行:7za a 001.7z 001.jpg;将001目录打包执行:7za a 001.7z 001;
d  从压缩里删除文件,如将001.7z里的001.jpg删除,执行:7za d 001.7z 001.jpg
l  列出压缩包里的文件,如列出001.7z里的文件,执行:7za l 001.7z
e  解压到当前目录,目录结构会被破坏,如001.rar内有如下目录及文件123/456/789.html,
执行:7za e 001.rar,目录123和456及文件789.html都会存放在当前目录下。
x  以完整路径解压。

7za x test.7z

2. CentOS7.0通过yum安装rz sz

yum install -y lrzsz

设置上传下载目录 

下载文件
sz /etc/samba/smb.conf
注意:下载到本地电脑的目录为:
C:\Program Files (x86)\SecureCRT\download
上传文件
rz 

3. 挂载数据盘

http://help.aliyun.com/knowledge_detail.htm?knowledgeId=5974154

df -h 查看磁盘使用情况

fdisk -l 查看数据盘情况

mount  查看挂载情况

硬盘挂着到/home下面 作为数据存储目录

4.CentOS7.0通过yum安装svn

参考链接 http://www.ha97.com/4467.html

注:当前所有操作都在/root目录

(0) 安装软件
#yum install subversion
(1). 新建一个目录用于存储SVN所有文件
# mkdir /home/svn

(2). 新建一个版本仓库
# svnadmin create /home/svn/project

(3). 初始化版本仓库中的目录
# mkdir project project/server project/client project/doc  project/mobile  //(建立临时目录)
# svn import project/ file:///home/svn/project -m "init svn dirs"
# rm -rf project (删除临时建立的目录)

(4). 添加用户
要添加SVN用户非常简单,只需在/home/svn/project/conf/passwd文件添加一个形如“username=password”的条目就可以了。为了测试,我添加了如下内容:

[users]
# harry = harryssecret
# sally = sallyssecret
pm = google
server = google
client = google
mobile = google
doc = google

(5). 修改用户访问策略

/home/svn/project/conf/authz记录用户的访问策略,以下是参考:

[groups]
project_p = pm
project_s = server
project_c = client
project_m = mobile
project_d = doc

[project:/]
@project_p = rw
* =

[project:/server]
@project_p = rw
@project_s = rw
* =

[project:/client]
@project_p = rw
@project_c = rw
* =

[project:/mobile]
@project_p = rw
@project_m = rw

[project:/doc]
@project_p = rw
@project_s = rw
@project_c = rw
@project_m = rw
@project_d = rw
* =

说明:以上信息表示,只有project_p用户组有根目录的读写权。r表示对该目录有读权限,w表示对该目录有写权限,rw表示对该目录有读写权限。最后一行的* =表示,除了上面设置了权限的用户组之外,其他任何人都被禁止访问本目录。这个很重要,一定要加上!

(6). 修改svnserve.conf文件,让用户和策略配置升效.
svnserve.conf内容如下:

[general]
anon-access = none
auth-access = write
password-db = /home/svn/project/conf/passwd
authz-db = /home/svn/project/conf/authz

(7). 启动服务器
# svnserve -d -r /home/svn
注意:如果修改了svn配置,需要重启svn服务,步骤如下:

# ps -aux|grep svnserve
# kill -9 ID号
# svnserve -d -r /home/svn

(8). 验证svn 
svn://公网IP/project/

5. CentOS7.0通过yum安装nginx

1.安装
yum install -y nginx

yum install -y pcre

2.命令行

(1) 检查Nginx配置文件的正确性
nginx -t //测试配置文件
nginx -t -c /etc/nginx/nginx.conf

[root@iZ28s8lydmdZ nginx]# nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

表示OK

(2) 显示版本号
nginx -v 或者 nginx -V

(3)nginx的启动
nginx 

查看启动进程 ps -ef | grep nginx

(4)nginx的关闭
kill -XXX pid 

XXX 就是信号

pid是进程号

信号地址:
Nginx对进程的控制能力非常强大,可以通过信号指令控制进程。常用的信号有:

QUIT,表示处理完当前请求后,关闭进程。

HUP,表示重新加载配置,也就是关闭原有的进程,并开启新的工作进程。此操作不会中断用户的访问请求,因此可以通过此信号平滑地重启Nginx。

USR1,用于Nginx的日志切换,也就是重新打开一个日志文件,例如每天要生成一个新的日志文件时,可以使用这个信号来控制。

USR2,用于平滑升级可执行程序。

WINCH ,从容关闭工作进程。

查处进程号:
ps -ef | grep "nginx: master process" | grep -v "grep" | awk -F ' ' '{print $2}'

或者
cat /opt/nginx/logs/nginx.pid 

(5) nginx的平滑重启

kill -HUP  'cat /opt/nginx/logs/nginx.pid'



nginx配置地址:/etc/nginx/nginx.conf
kill -HUP 5855


阿里云nginx安全配置:
http://help.aliyun.com/knowledge_detail.htm?spm=5176.788314971.3.11.OfVkqk&knowledgeId=5974693&categoryId=8314971

6.CentOS7.0通过yum安装mysql5.6

#] wget http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm
#] rpm -ivh mysql-community-release-el7-5.noarch.rpm
#] yum install mysql-community-server -y

使用

(1)查看状态
service mysqld status
(2)启动
service mysqld start
(3)再次查看状态  发现已经启动完成了
service mysqld status

首次登陆sql 设置passwd(密码示例使用 google)
[root@iZ28s8lydmdZ ~]# mysql -uroot
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.6.27 MySQL Community Server (GPL)

Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> set password for "root"@"localhost"=password("google");
Query OK, 0 rows affected (0.00 sec)

mysql> exit
Bye
[root@iZ28s8lydmdZ ~]# mysql -uroot -pgoogle
Warning: Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.6.27 MySQL Community Server (GPL)

Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> 
(4)修改MYSQL root用户远程访问权限
首先
[root@iZ28s8lydmdZ ~]# mysql -uroot -pgoogle
mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'google' WITH GRANT OPTION;
Query OK, 0 rows affected (0.00 sec)
mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)
mysql> exit
Bye

然后修改配置文件 /etc/my.cnf
#]vi /etc/my.cnf 
在其中增加一行
bind-address=你机器的IP


重启mysql

#]service mysqld restart

(5)创建库和其他用户访问权限设置
mysql -uroot -pgoogle
mysql> create database wifitest default character set utf8; 
mysql> create database wifi default character set utf8;
mysql> GRANT ALL PRIVILEGES ON *.* TO 'normal'@'%' IDENTIFIED BY 'google' WITH GRANT OPTION;
Query OK, 0 rows affected (0.00 sec)

mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)

(6) 修改配置文件,改变数据库存放地址,这里放到数据盘上,避免空间问题
创建目录和文件 
mkdir /home/mysql/mysql  
mkdir /home/mysql/log  
mkdir /home/mysqld
touch /home/mysqld/mysqld.pid


 /etc/my.cnf

[client]
socket=/home/mysql/mysql.sock  

[mysqld]
#datadir=/var/lib/mysql
datadir=/home/mysql

#socket=/var/lib/mysql/mysql.sock
socket=/home/mysql/mysql.sock

# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0

# Recommended in standard MySQL setup
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES

[mysqld_safe]
#log-error=/var/log/mysqld.log
log-error=/home/mysql/log/mysqld.log
#pid-file=/var/run/mysqld/mysqld.pid
pid-file=/home/mysql/mysqld.pid

bind-address=(Your Own IP Here!)

vi /usr/bin/mysql-systemd-start
也需要对相应的目录进行修改


install_db () {
    # Note: something different than datadir=/var/lib/mysql requires SELinux policy changes (in enforcing mode)
    datadir=$(get_option mysqld datadir "/home/mysql")

    # Restore log, dir, perms and SELinux contexts
    [ -d "$datadir" ] || install -d -m 0755 -omysql -gmysql "$datadir" || exit 1
    log=/home/mysql/log/mysqld.log
    [ -e $log ] || touch $log
    chmod 0640 $log
    chown mysql:mysql $log || exit 1
    if [ -x /usr/sbin/restorecon ]; then
        /usr/sbin/restorecon "$datadir"
        /usr/sbin/restorecon $log
    fi

    # If special mysql dir is in place, skip db install
    [ -d "$datadir/mysql" ] && exit 0

    # Create initial db
    /usr/bin/mysql_install_db --rpm --datadir="$datadir" --user=mysql
    exit 0
}

pinger () {
    # Wait for ping to answer to signal startup completed,
    # might take a while in case of e.g. crash recovery
    # MySQL systemd service will timeout script if no answer
    datadir=$(get_option mysqld datadir "/home/mysql")
    socket=$(get_option  mysqld socket "$datadir/mysql.sock")
    case $socket in
        /*) adminsocket="$socket" ;;
        *) adminsocket="$datadir/$socket" ;;
    esac
	


拷贝原来目录下的数据到对应新目录数据
chmod -R 777 /home/mysql/
/home/mysql/mysqld.pid  由于会自己创建 先删除掉
#]service mysqld restart 重启生效

注:
1. 如果重启不成功,可以查看/home/mysql/log/mysqld.log 日志文件进行查看错误情况
2. /etc/my.cnf务必加上,否则执行mysql -uroot -pgoogle 保持,因为client还是链接原来的sock文件
[client]
socket=/home/mysql/mysql.sock  

参考链接:

1). http://help.aliyun.com/knowledge_detail/7595123.html?spm=5176.7618386.5.1.UnQUJA

2). http://www.cnblogs.com/cnblogsfans/archive/2009/09/21/1570942.html

3). http://www.cnblogs.com/wuhou/archive/2008/09/28/1301071.html

7.CentOS7.0通过yum安装Redis

Redis主站点:http://redis.io/download
(1). 编译工具安装
yum install -y tcl
yum install gcc gcc-c++ gcc-g77 flex bison autoconf automake bzip2-devel zlib-devel ncurses-devel libjpeg-devel libpng-devel libtiff-devel freetype-devel pam-devel openssl-devel libxml2-devel gettext-devel pcre-devel

(2). 下载源码包
wget http://download.redis.io/releases/redis-3.0.0.tar.gz

(3). 编译
[root@iZ28s8lydmdZ src]# tar xvzf redis-3.0.0.tar.gz 
[root@iZ28s8lydmdZ src]# cd redis-3.0.0/
[root@iZ28s8lydmdZ src]# make install
[root@iZ28s8lydmdZ src]# make test

make命令执行完成后,会在src目录下生成5个可执行文件,
分别是redis-server、redis-cli、redis-benchmark、redis-check-aof、redis-check-dump,它们的作用如下:
redis-server:Redis服务器的daemon启动程序
redis-cli:Redis命令行操作工具。当然,你也可以用telnet根据其纯文本协议来操作
redis-benchmark:Redis性能测试工具,测试Redis在你的系统及你的配置下的读写性能
redis-check-aof:更新日志检查
redis-check-dump:用于本地数据库检查
(4). 可执行文件位置一般在
/usr/local/bin 

(5). redis的配置和运行

创建和修改 /etc/redis/redis.conf

1)创建/etc/redis目录,
拷贝源码根目录下的redis.conf 到/etc/redis/下面
修改其中的

daemonize yes         //让server在后台运行,先可以不改,等调试完成了再改该属性
dir /home/redis/      //数据保存位置
pidfile /home/redis/redis.pid  //进程pid保存位置
requirepass (这里是密码)       //redis密码

2)创建/home/redis/redis.pid
切换到home下面创建目录 /home/redis/, 创建文件/home/redis/redis.pid

3)运行
#start redis server
/usr/local/bin/redis-server /etc/redis/redis.conf

出现下面3个warning,

# Server started, Redis version 3.0.0
# WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this          issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
# WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled.
# WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.

解决:
1). echo 1 > /proc/sys/vm/overcommit_memory
   参考:http://blog.csdn.net/whycold/article/details/21388455
        http://www.chengfei.net/
2). echo never > /sys/kernel/mm/transparent_hugepage/enabled
3). echo 511 > /proc/sys/net/core/somaxconn
注:
redis 默认不需要密码即可访问,黑客直接访问即可获取数据库中所有信息,造成严重的信息泄露。
修复方案: 设置访问密码
在 redis.conf 中找到“requirepass”字段,在后面填上你需要的密码。
注:需要重启redis才能生效。

参考链接:

	1). http://www.cnblogs.com/hb_cattle/archive/2011/10/22/2220907.html
	2). redis集群的部署方案  http://redis.io/topics/cluster-tutorial

8.CentOS7.0通过yum安装VNC

1). http://www.ha97.com/4634.html