On a new server, set up the environment, configure yum source, install httpd service, Add the corresponding firewall port, format the hard disk partition 666MB, mount it under /homework, and it will take effect permanently:
Ideas
1. Check the environment
2. Configure Yum source
4. Installation service
5. Add firewall
< p> 6. Add hard disk
7. Partition formatting
8. Mount p>
Process:
1. Check the environment
getenforce setenforce 0
#Turn off selinux
A: vi /etc/selinux/config
###SELINUX=disabled
B: echo -e "SELINUX=disabled SELINUXTYPE=targedited< /span>">
/etc/selinux/config
C: cat > /etc/selinux/config << QQQ
> SELINUX=disabled
> SELINUXTYPE=targeted
> QQQ
#View firewall status (because it is enabled by default, so You can omit this step)
systemctl status firewalld
systemctl enable firewalld
systemctl restart firewalld
2. Configure IP
ip a
A:
vi /etc/sysconfig/network-scripts/ifcfg-ens33
################
NAME=ens33
DEVICE=ens33
ONBOOT=yes
BOOTPROTO=none
IPADDR=192.168.59.103
NETMASK=255.255.255.0
GATEWAY=192.168.59.2
DNS1=192.168.59.2
##################
Systemctl restart network
B:
echo "NAME=ens33
DEVICE=ens33
ONBOOT=yes
BOOTPROTO=none
IPADDR=192.168.59.103
NATEMASK=255.255.255.0
GATEWAY=192.168.59.2
DNS1=192.168.59.2"> /etc/sysconfig/network-scripts/ifcfg-ens33
systemctl restart network
3. Configure yum source
mkdir /iso
mount /dev/cdrom /iso
A: vim /etc/fstab
##################
/dev/sr0 /iso iso9660 defaults 0 0
##################
B: Echo "/dev/sr0 /iso iso9660 defaults 0 0 " >> /etc/fstab
mkdir /etc/yum.repos.d/bak
mv /etc/yum.repos.d/*.repo / etc/yum.repos.d/bak
A: vim /etc/yum.repos.d/iso.repo
##################
[iso]
Name=iso
Baseurl=file:///iso
Disable=1
Gpgcheck=0
##################
B:cat>/etc/yum.repos.d/iso.repo <[iso]
Name=iso
Baseurl=file:///iso
Disable=1
Gpgcheck=0
QQQ
C: echo -e "[iso] name=isoaseurl=file:///iso enable=1 gpgcheck=0 "
> /etc/yum.repos.d/iso.repo
4. Installation service
yum -y install httpd vim net-tools
rm -rf /etc/httpd/conf.d/welcome.conf
curl www.baidu.com > /var/www/html/ index.html
vim /var/www/html/index.html(Edit homepage )
systemcul start httpd
systemcul enable httpd
5. Add firewall< /p>
systemcul status firewalld
A: firewall-cmd --add-service=http
firewall-cmd --add-service=http --permanent
B: firewall-cmd --add-port=80/tcp
firewall-cmd --add-port=80/tcp -- permanent
firewall-cmd --reload
6. Add hard disk
A: echo "< /span>---"> /sys/class/scsi_host/host0/scan
echo "---"> /sys/class/scsi_host/host1/ scan
echo "---"> /sys/class/scsi_host/host2/ scan
B: echo "scsi add-single-device 0 0 2 0 "> /proc/scsi/scsi
echo "scsi add-single-device 0 0 3 0 span>"> /proc/scsi/scsi
echo "scsi add-single-device 0 0 4 0 span>"> /proc/scsi/scsi
7. Partition formatting
fdisk /dev/sdb <<QQQ
Space (indicating the Enter key)
n
Space (indicating the Enter key)
Space (indicating the Enter key)
Space (indicating the Enter key)
+666M
Space (indicating the Enter key)
w
QQQ
mkfs.xfs /dev/sdb1
8. Mount
mkdir /work
mount /dev/sdb1 /work
echo "/dev/sdb1 /work xfs defaults 0 0 span>" >> /etc/fstab
getenforce setenforce 0
A: vi /etc/selinux/config
###SELINUX=disabled
B: echo -e "SELINUX=disabled SELINUXTYPE=targedited< /span>">
/etc/selinux/config
C: cat > /etc/selinux/config << QQQ
> SELINUX=disabled
> SELINUXTYPE=targeted
> QQQ
systemctl status firewalld
systemctl enable firewalld
systemctl restart firewalld
ip a
A:
vi /etc/sysconfig/network-scripts/ifcfg-ens33
################
NAME=ens33
DEVICE=ens33
ONBOOT=yes
BOOTPROTO=none
IPADDR=192.168.59.103
NETMASK=255.255.255.0
GATEWAY=192.168.59.2
DNS1=192.168.59.2
##################
Systemctl restart network
B:
echo "NAME=ens33
DEVICE=ens33
ONBOOT=yes
BOOTPROTO=none
IPADDR=192.168.59.103
NATEMASK=255.255.255.0
GATEWAY=192.168.59.2
DNS1=192.168.59.2"> /etc/sysconfig/network-scripts/ifcfg-ens33
systemctl restart network
mkdir /iso
mount /dev/cdrom /iso
A: vim /etc/fstab
##################
/dev/sr0 /iso iso9660 defaults 0 0
##################
B: Echo "/dev/sr0 /iso iso9660 defaults 0 0 " >> /etc/fstab
mkdir /etc/yum.repos.d/bak
mv /etc/yum.repos.d/*.repo / etc/yum.repos.d/bak
A: vim /etc/yum.repos.d/iso.repo
##################
[iso]
Name=iso
Baseurl=file:///iso
Disable=1
Gpgcheck=0
##################
B:cat>/etc/yum.repos.d/iso.repo <[iso]
Name=iso
Baseurl=file:///iso
Disable=1
Gpgcheck=0
QQQ
C: echo -e "[iso] name=isoaseurl=file:///iso enable=1 gpgcheck=0 "
> /etc/yum.repos.d/iso.repo
yum -y install httpd vim net-tools
rm -rf /etc/httpd/conf.d/welcome.conf
curl www.baidu.com > /var/www/html/ index.html
vim /var/www/html/index.html(Edit homepage )
systemcul start httpd
systemcul enable httpd
systemcul status firewalld
A: firewall-cmd --add-service=http
firewall-cmd --add-service=http --permanent
B: firewall-cmd --add-port=80/tcp
firewall-cmd --add-port=80/tcp -- permanent
firewall-cmd --reload
A: echo "---" > /sys/class/scsi_host/host0/scan
echo "---"> /sys/class/scsi_host/host1/ scan
echo "---"> /sys/class/scsi_host/host2/ scan
B: echo "scsi add-single-device 0 0 2 0 "> /proc/scsi/scsi
echo "scsi add-single-device 0 0 3 0 span>"> /proc/scsi/scsi
echo "scsi add-single-device 0 0 4 0 span>"> /proc/scsi/scsi
fdisk /dev/sdb <<QQQ
Space (indicating the Enter key)
n
Space (indicating the Enter key)
Space (indicating the Enter key)
Space (indicating the Enter key)
+666M
Space (indicating the Enter key)
w
QQQ
mkfs.xfs /dev/sdb1
mkdir / work
mount /dev/sdb1 /work
echo "/dev/sdb1 /work xfs defaults 0 0 span>" >> /etc/fstab