【Linux】日常代码日志
本帖最后由 寂寞老男孩 于 2017-2-12 03:34 编辑前提条件centos7 最小化安装
#vi /etc/sysconfig/network-scripts/ifcfg-eno16777736
TYPE="Ethernet"
BOOTPROTO="dhcp"
DEFROUTE="yes"
PEERDNS="yes"
PEERROUTES="yes"
IPV4_FAILURE_FATAL="no"
IPV6INIT="yes"
IPV6_AUTOCONF="yes"
IPV6_DEFROUTE="yes"
IPV6_PEERDNS="yes"
IPV6_PEERROUTES="yes"
IPV6_FAILURE_FATAL="no"
NAME="eno16777736"
UUID="42cc901d-61a1-4a4d-89ed-979cec402a7a"
DEVICE="eno16777736"
ONBOOT="no"//改为ONBOOT="yes"连入外网
Day1//主要是不早了,然后明天要画组织结构图,才能逐个进行配置。
#yum install vim //安装vim
#yum install iptables-services //安装iptables
#vi /etc/sysconfig/iptables //编辑iptables
-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 3306 -j ACCEPT //Mysql端口
-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 443 -j ACCEPT //https端口
:wq //保存并退出
#yum install wget //安装wget
Day2
#alias vi='vim'//设置vi=vim
#yum install httpd//安装Apache
#yum install mariadb mariadb-server//安装mariadb
#yum install httpd vsftpd //安装http和ftp
#systemctl stop firewalld.service //停止firewall
#systemctl disable firewalld.service //禁止firewall开机启动
#yum install php php-gd php-xml php-mysql//安装php
//关闭SELINUX
#vi /etc/selinux/config
#SELINUX=enforcing //注释掉
#SELINUXTYPE=targeted //注释掉
SELINUX=disabled //增加
:wq! 保存退出
#setenforce 0 //使配置立即生效
#systemctl start httpd.service //开启http服务
#systemctl enable httpd.service //开机启动http服务
#systemctl start vsftpd.service //启动ftp服务
#systemctl enable vsftpd.service //开机启动ftp服务
#systemctl start mariadb.service //开始mariadb服务
#systemctl enable mariadb.service //开机启动mariadb服务
#systemctl list-unit-files | grep enabled //查看开机启动服务
正确显示结果
auditd.service enabled
autovt@.service enabled
crond.service enabled
dbus-org.freedesktop.NetworkManager.service enabled
dbus-org.freedesktop.nm-dispatcher.serviceenabled
getty@.service enabled
httpd.service enabled
iptables.service enabled
irqbalance.service enabled
kdump.service enabled
lvm2-monitor.service enabled
mariadb.service enabled
microcode.service enabled
NetworkManager-dispatcher.service enabled
NetworkManager.service enabled
postfix.service enabled
rsyslog.service enabled
sshd.service enabled
systemd-readahead-collect.service enabled
systemd-readahead-drop.service enabled
systemd-readahead-replay.service enabled
tuned.service enabled
vsftpd.service enabled
dm-event.socket enabled
lvm2-lvmetad.socket enabled
lvm2-lvmpolld.socket enabled
default.target enabled
multi-user.target enabled
remote-fs.target enabled
runlevel2.target enabled
runlevel3.target enabled
runlevel4.target enabled
# useradd -g root -M -d /var/www/html -s /sbin/nologin Kr //在root组中加入一个Kr账户用来ftp到/var/www/html并给它添加密码,并且不允许登录Linux系统
# passwd Kr
#输入密码 //备忘:KINGVON1
#chown -R Kr.root /var/www/html //把/var/www/html的所有权给Kr.root
# vi /etc/vsftpd/vsftpd.conf
# (INSERT)anonymous_enable=YES 改为 anonymous_enable=NO
# (ESC):wq //配置vsftpd,禁止匿名用户登陆
yum localinstall http://rpms.famillecollet.com/enterprise/remi-release-7.rpm //设置第三方yumREMI
#yum install phpmyadmin php-mcrypt //安装phpmyadmin
#mysql_secure_installation//设置root账户mysql密码
Day3
#vi /etc/httpd/conf.d/phpMyAdmin.conf
. . . . .
<Directory /usr/share/phpMyAdmin/>
AddDefaultCharset UTF-8
<IfModule mod_authz_core.c>
# Apache 2.4
<RequireAny>
#Require ip 127.0.0.1
#Require ip ::1
Require all granted
</RequireAny>
</IfModule>
<IfModule !mod_authz_core.c>
# Apache 2.2
Order Deny,Allow
Deny from All
Allow from 127.0.0.1
Allow from ::1
</IfModule>
</Directory>
<Directory /usr/share/phpMyAdmin/setup/>
<IfModule mod_authz_core.c>
# Apache 2.4
<RequireAny>
#Require ip 127.0.0.1
#Require ip ::1
Require all granted
</RequireAny>
</IfModule>
<IfModule !mod_authz_core.c>
# Apache 2.2
Order Deny,Allow
Deny from All
Allow from 127.0.0.1
Allow from ::1
</IfModule>
</Directory>
. . . . .
页:
[1]