[systemctl]
systemctl是CentOS7的服务管理工具中主要的工具,它融合了之前版本的service和chkconfig功能
启动一个服务:systemctl start firewalld.service
关闭一个服务:systemctl stop firewalld.service
重启一个服务:systemctl restart firewalld.service
显示一个服务的状态: systemctl status firewalld.service
在开机时启用一个服务:systemctl enable firewalld.service
在开机时禁用一个服务:systemctl disable firewalld.service
查看服务是否开机启动:systemctl is-enabled firewalld.service
查看已启动的服务列表:systemctl list-unit-files|grep enabled
查看启动失败的服务列表:systemctl --failed
查看所有的已安装软件名称 rpm -qa 查看指定已安装软件名称 rpm -ql 软件名称
安装Apache, PHP, MySQL以及php连接mysql库组件
yum -y install httpd php mysql mysql-server php-mysql
[Apache]
在/etc/httpd/conf/httpd.conf配置文件中
service httpd start
service httpd restart
service httpd stop
[PHP]
php -v 查看版本
[mysql]
安装前先卸载mariadb(如果有的话)
#列出所有被安装的rpm package
rpm -qa | grep mariadb
#逐个删除每一个列出来的文件,--nodeps强制删除
rpm -e --nodeps mariadb- libs-************.x86_64
wget https://dev.mysql.com/get/mysql57-community-release-el7-9.noarch.rpm
rpm -ivh mysql57-community-release-el7-9.noarch.rpm
执行完成后会在/etc/yum.repos.d/目录下生成两个repo文件mysql-community.repo mysql-community-source.repo
yum install mysql-server
systemctl start mysqld #启动MySQL
grep 'temporary password' /var/log/mysqld.log
登录:mysql -u root -pxxxxx
修改密码:set password=password("yourpassword");
开启远程控制
grant all privileges on *.* to root@"%" identified by "123456789";
flush privileges; #刷新刚才的内容
配置默认编码为utf8:
vi /etc/my.cnf
#添加
[mysqld]
character_set_server=utf8
init_connect='SET NAMES utf8'
其他默认配置文件路径:
配置文件:/etc/my.cnf
日志文件:/var/log//var/log/mysqld.log
服务启动脚本:/usr/lib/systemd/system/mysqld.service
socket文件:/var/run/mysqld/mysqld.pid
systemctl enable mysqld #开机启动 或者: service mysql enable
systemctl start mysqld #启动服务 或者: service mysql start
systemctl restart mysqld #重启服务 或者: service mysql restart
systemctl stop mysqld #停止服务 或者:service mysqld stop
[SVN]
yum install subversion
创建版本库:svnadmin create /svn/project
删除版本库:sudo rm -rf project
修改/svn/project/conf/svnserve.conf
anon-access = read
auth-access = write
password-db = passwd
authz-db = authz
realm = project
修改/svn/project/conf/authz
[aliases]
# joe = /C=XZ/ST=Dessert/L=Snake City/O=Snake Oil, Ltd./OU=Research Institute/CN=Joe Average
[groups]
# harry_and_sally = harry,sally
# harry_sally_and_joe = harry,sally,&joe
admin = hzqghost
# [/foo/bar]
# harry = rw
# &joe = r
# * =
# [repository:/baz/fuz]
# @harry_and_sally = rw
# * = r
[/]
@admin =rw
修改/svn/project/conf/password
[users]
# harry = harryssecret
# sally = sallyssecret
hzqghost = %45FE56
启动 svnserve -d -r /svn/project/
然后查看一下svn的进程,命令 ps -ef|grep svnserve
连接 svn co svn://路径(目录或文件的全路径) [本地目录全路径] --username 用户名 --password 密码
[防火墙]
启动: systemctl start firewalld
查看状态: systemctl status firewalld
停止: systemctl disable firewalld
禁用: systemctl stop firewalld
查看版本: firewall-cmd --version
查看帮助: firewall-cmd --help
显示状态: firewall-cmd --state
查看所有打开的端口: firewall-cmd --zone=public --list-ports
更新防火墙规则: firewall-cmd --reload
查看区域信息: firewall-cmd --get-active-zones
查看指定接口所属区域: firewall-cmd --get-zone-of-interface=eth0
拒绝所有包:firewall-cmd --panic-on
取消拒绝状态: firewall-cmd --panic-off
查看是否拒绝: firewall-cmd --query-panic
添加
a. firewall-cmd --zone=public --add-port=8080/tcp --permanent
(--permanent永久生效,没有此参数重启系统后失效 )
b. firewall-cmd --reload
查看
firewall-cmd --zone=public --query-port=8080/tcp
删除
firewall-cmd --zone=public --remove-port=8080/tcp --permanent
查看firewall是否运行,下面两个命令都可以
systemctl status firewalld.service
firewall-cmd --state
查看当前开了哪些端口
其实一个服务对应一个端口,每个服务对应/usr/lib/firewalld/services下面一个xml文件。
firewall-cmd --list-services
查看还有哪些服务可以打开 firewall-cmd --get-services