CentOS7服务器常用配置

mysql
安装 直接yum install mysql-server是不可以的
1 wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm
2 rpm -ivh mysql-community-release-el7-5.noarch.rpm
3 yum install mysql-server

修改密码

UPDATE USER SET password=password('123456') WHERE USER='root';
UPDATE USER SET authentication=password('123456') WHERE USER='root';
--5.7
UPDATE USER SET authentication_string=password('123456') WHERE USER='root';

修改远程连接权限

GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '123456' WITH GRANT OPTION;
FLUSH privileges;

—————————————————————————–
防火墙
开放端口
firewall-cmd –zone=public –add-port=80/tcp –permanent
–zone #作用域
–add-port=80/tcp #添加端口,格式为:端口/通讯协议
–permanent #永久生效,没有此参数重启后失效
–list-all

关闭及禁止开机启动
systemctl stop firewalld.service #停止firewall
systemctl disable firewalld.service #禁止firewall开机启动
—————————————————————————–
apache
yum install httpd
开机启动
systemctl enable httpd.service
apache虚拟目录,配置文件路径/etc/httpd
与Windows下不同的是,httpd.conf不用修改
在conf.d目录下创建httpd-vhosts.conf文件,编辑内容如下

<VirtualHost *:80>  
 ServerName www.test.com
 DocumentRoot "/var/www/test"  
 DirectoryIndex index.html index.php  
 <Directory "/var/www/test">  
  Options -Indexes +FollowSymlinks  
  AllowOverride All  
  Require all granted  
 </Directory>  
</VirtualHost>

—————————————————————————–
php
yum install php
yum install php-mysql php-gd libjpeg* php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-bcmath php-mhash
—————————————————————————–
svn
****安装
yum install subversion
svnserve -version
mkdir svn
cd svn
mkdir pro1
svnadmin create /root/svn/pro1/
****配置
编辑authz

[groups]
admin = zhangsan
[pro1:/]
@admin = rw
* =

编辑passwd

[users]
zhangsan = 123456

编辑svnserve.conf

anon-access = none
auth-access = write
password-db = /root/svn/pro1/conf/passwd
authz-db = /root/svn/pro1/conf/authz
realm = /root/svn/pro1

****测试
[注意此处是/root/svn不是/root/svn/pro1]
# svnserve -d -r /root/svn
# ps -aux|grep svnserve
****开机启动
编辑/etc/rc.d/rc.local
echo “svnserve -d -r /root/svn”>>/etc/rc.d/rc.local
—————————————————————————–
java
yum list java*
yum install java-1.8.0-openjdk.x86_64
—————————————————————————–
tomcat
tar -zxvf apache-tomcat-8.5.5.tar.gz
cd bin
./startup.sh
****开机启动
编辑/etc/rc.d/rc.local
echo “/root/apache-tomcat-8.5.5/bin/startup.sh”>>/etc/rc.d/rc.local
****apache虚拟主机
修改httpd-vhosts.conf,加入以下代码

<VirtualHost *:80>
    ServerName www.test.com
    ProxyPass / ajp://127.0.0.1:8009/
    ProxyPassReverse / ajp://127.0.0.1:8009/
</VirtualHost>