1、环境准备
(1)yum源 (一个云仓库+pepl仓库)
[root@web ~]# vim /etc/yum.repos.d/hh.repo
[a]
name=a
baseurl=file:///mnt
gpgcheck=0
[root@web ~]# vim /etc/fstab
/dev/cdrom /mnt iso9660 defaults 0 0
[root@web ~]# mount -a
[root@web ~]# yum repolist
[root@web ~]# ping www.baidu.com
[root@web ~]# yum -y install wget
[root@web ~]# vim /etc/resolv.conf
将dns该为114.114.114.114 8.8.8.8
[root@web ~]# ping www.baidu.com //可以ping通百度即可进行下一步
[root@web ~]# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.cloud.tencent.com/repo/centos7_base.repo
[root@web ~]# yum clean all
[root@web ~]# yum makecache
[root@web ~]# yum -y install epel-release.noarch
[root@web ~]# yum clean all
[root@web ~]# yum makecache
(2)防火墙和selinux
[root@web ~]# systemctl stop firewalld
[root@web ~]# systemctl disable firewalld
Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
[root@web ~]# setenforce 0
[root@web ~]# vim /etc/selinux/config
SELINUX=permissive
2、安装配置web服务器
(1)使用自建的yum仓库下载nginx
1、先只安装不下载nginx
[root@web ~]# yum -y install --downloadonly --downloaddir=./soft/ nginx
2、下载cteaterepo,自建仓库
[root@web ~]# yum -y install createrepo
[root@web ~]# createrepo ./soft/
[root@web ~]# ls soft/
[root@web ~]# vim /etc/yum.repos.d/nginx.repo
[nginx]
name=nginx
baseurl=file:///root/soft/
gpgcheck=0
enable=1
[root@web ~]# yum clean all
[root@web ~]# yum makecache
3、使用自己建造的仓库下载nginx
[root@web ~]# yum -y install nginx
[root@web ~]# nginx //启动nginx
检查服务是否启动:
[root@web ~]# netstat -lnput | grep nginx
[root@web ~]# ps -aux | grep nginx
浏览器访问测试:
(2)在nginx的首页中插入自己的图片与视频
1、查找nginx的配置文件位置
[root@web html]# find / | grep nginx
/usr/share/nginx/html
[root@web html]# rpm -ql nginx
/usr/share/nginx/html/404.html
[root@web nginx]# cd /usr/share/nginx/html/
[root@web html]# ls
404.html 50x.html en-US icons img index.html nginx-logo.png poweredby.png
2、将图片与视频放到指定路径下
可以将其直接拖拽到vm中,也可以使用scp进行传输文件。
[root@web html]# yu