サーバー側での操作:
ソースコードからnginxをインストールします。
yum -y install gcc gcc-c++ pcre pcre-devel zlib-devel openssl-devel
cd nginx-1.12.2
预编译:
./configure --prefix=/usr/local/nginx
编译和安装
make && make install
nginx.confファイルに追加します
location / {
autoindex on;
autoindex_exact_size off;
autoindex_localtime on;
}
イメージパッケージをマウントします。
mount /dev/cdrom /mnt -o loop
nginxのデフォルトのリリースパスを削除します。
rm -rf /usr/local/nginx/html
ソフト接続を構成します。
ln -s /mnt/ /usr/local/nginx/html
nginxプロセスを開始します
/usr/local/nginx/sbin/nginx
リンクテスト:
クライアントでの操作:
ステップ6:yumリポジトリファイルを作成する
[root@localhost ~]# vim /etc/yum.repos.d/local.repo
[local]
name=local
#在虚拟机网络环境中,母机地址是这个
baseurl=http://192.168.40.111
#是否可用,1表示可用,0表示不可用
enabled=1
gpgcheck=1
gpgkey=http://192.168.40.111/RPM-GPG-KEY-CentOS-7
ステップ7:他のリポジトリファイルを無効にする
编辑其他repo文件,将enabled设置为0
……
enabled=0
……
ステップ7:yum関連
#清理无用源
yum clean all
#查看列表中是否存在
yum repolist
#实际安装一个软件试试看,比如httpd
yum install httpd