FTP
yum -y install vsftpd #安装vsftpd服务
systemctl enable vsftpd.service #设置vsftpd服务自启动
vsftpd -v #查看vsftpd服务版本
#然后用root账户登录ftp,下载/etc/vsftpd/vsftpd.conf,修改以下部分
anonymous_enable=NO #设置不允许匿名访问
local_enable=YES #设置本地用户可以访问
chroot_list_enable=YES #使用户不能离开主目录
chroot_list_file=/etc/vsftpd/chroot_list
修改主机名
hostnamectl set-hostname 新主机名
防火墙
CENTOS7默认是firewalld,改为iptables
systemctl stop firewalld.service #停止firewall
systemctl disable firewalld.service #禁止firewall开机启动
yum install iptables #安装iptables
yum install iptables-services #安装iptables-services
#修改/etc/sysconfig/iptables,配置防火墙
-A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT #SSH
-A INPUT -p tcp -m state --state NEW -m tcp --dport 21 -j ACCEPT #FTP
-A INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT #HTTP
-A INPUT -p tcp -m state --state NEW -m tcp --dport 3306 -j ACCEPT #MySQL
-A INPUT -p tcp -m state --state NEW -m tcp --dport 443 -j ACCEPT #HTTPS
LAMP
安装Apache,PHP,MySQL,PHP连接MySQL库组件
yum -y install httpd php ysql mysql-server php-mysql
创建一个新用户
useradd username #创建一个自己的用户
passwd username #设定username这个用户的密码
username ALL=(ALL) ALL #在root ALL=(ALL) ALL下面加入,表示把username加入sudoers组
mkdir conf #在家目录创建conf文件夹
ln -s /etc/httpd httpd #新建Apache软连接
mariadb配置
linux改了。。。默认是mariadb了,那就这样吧,配置还是照改
port=3306 #端口号
thread_concurrency = 2 #并发线程数,建议CPU核数乘2,因为是单核CPU,所以双线程
init_connect='SET collation_connection = utf8_general_ci'
init_connect='SET NAMES utf8'
character-set-server=utf8 #默认编码
collation-server=utf8_general_ci #默认排序方式
skip-character-set-client-handshake
[client]
default-character-set=utf8
[mysql]
default-character-set=utf8
此外,还要用mysql -u root -p进入mariadb运行
GRANT ALL PRIVILEGES ON . TO ‘root’@’%’IDENTIFIED BY ‘123456’ WITH GRANT OPTION;(123456为登录密码)
flush privileges;
使mariadb可以被远程访问,这样就可以用navicat来访问了
启动与自启动
systemctl start iptables.service
systemctl start httpd.service
systemctl start vsftpd.service
systemctl start mariadb.service
systemctl enable iptables.service
systemctl enable httpd.service
systemctl enable vsftpd.service
systemctl enable mariadb.service