Change yum install redhat source and PHP environment

redhat yum update source

Delete yum source together with the installation of RHEL

rpm -qa | grep yum # yum view local

yum list | wc -l # look at the number of

yum install pip # look at the phenomenon

rpm -qa | grep yum | xargs rpm -e --nodeps # unload local yum, do not check dependencies, yum uninstall program

Reinstall yum Source:

https://blog.51cto.com/xiaocao13140/2131856 gave 3

  • python-urlgrabber-3.9.1-11.el6.noarch.rpm

  • yum-plugin-fastestmirror-1.1.30-40.el6.noarch.rpm

  • yum-3.2.29-81.el6.centos.noarch.rpm

https://blog.csdn.net/u013605322/article/details/79726564 to five

rpm-4.11.3-25.el7.x86_64.rpm

yum-metadata-parser-1.1.4-10.el7.x86_6

python-urlgrabber-3.10-8.el7.noarch.rpm

yum-3.4.3-154.el7.centos.noarch.rpm

yum-plugin-fastestmirror-1.1.31-42.el7.noarch.rpm

The second source, for example to

Reinstall yum

0, yum install shared files: see the back of the virtual machine to access local files

1, yum and other rpm Download http://mirrors.163.com/centos/7/os/x86_64/Packages/

2, in order to install

If the conflict, plus force

rpm -ivh --force rpm-4.11.3-35.el7.x86_64.rpm yum-metadata-parser-1.1.4-10.el7.x86_64.rpm python-urlgrabber-3.10-9.el7.noarch.rpm yum-3.4.3-161.el7.centos.noarch.rpm yum-plugin-fastestmirror-1.1.31-50.el7.noarch.rpm

Yum install a local source (ISO)

OK redhat version and install the current situation

1, version and installation location: the virtual machine or physical machine

Physical machine

2, yum source is installed

redhat free of charge, but the service should be charged yum, yum configuration do not want to pay for it myself source like;

If the Lord would not have the deep pockets of their allocation, the money and effort ah.

3. If you do not buy, it is necessary to configure their own insurance purposes including three sources:

1. Local yum source is your local ISO

Configuring source 163

3. Configure epel source

4, redhat if there is no network, you can only rely on local sources of yum. There are two kinds of local yum source selection: installation ISO files in the source and yum yum source other systems (requires prior download), such as yum centos source, because centos is free

5, if there is a local installation CD, mount - Copy - configuration - update the cache, in this link, it will go into detail later

https://blog.csdn.net/qq_33290422/article/details/79917335

6, if there is no CD-ROM installed, downloaded to your hard drive, then mount - Copy - Configuration - Update Cache

Find the location of the ISO image file

find / -name '*.iso'

Mount ISO image

eg

sudo mount /dev/sr0 /mnt/cdrom

ls / mnt / cdrom # verify

df -TH view disk size, resolve: delete large useless files df -i to see inode: the number of bytes of the file, the owner of id, group id, permission to change the position of the time, the number of links, data block, the solution: Remove excessive number of small files

Modify the default configuration of yum source

1, redhat7.3, there is a redhat.repo /etc/yum.repos.d/ next file, delete it, vi local.repo

[rhel]
name =Red Hat enterprise Linux 7
baseurl=file:///mnt/cdrom
enable=1
gpgkey=1
gpgkey=file:///mnt/cdrom/RPM-GPG-KEY-redhat-release

2, update the cache

 

 

 

Some of yum installation with ISO rpm

cd /mnt/cdrom/P

Yum install a local source (prior to download network)

Virtual machines to access local files

1, the stuffed ISO file, the mount / dev / sr0 to / mnt / cdrom use

2, the shared folder method

a. https://cloud.tencent.com/developer/article/1391053

. B and see if success:

vmware-hgfsclient

. C Mount:

mount -t vmhgfs .host:/ /mnt/udisk

or

vmhgfs-fuse .host:/ /mnt/udisk

3, the hard disk mounted directly, but rely ntfs-3g-2017.3.23-6.el7.x86_64.rpm, if no network can not be installed in addition to method 1,2

Mount Method: mount -t / dev / sdb1 / mnt / tt

Download the pre-installed with yum rpm

centos7 rpm source of Download

http://mirrors.163.com/centos/7/os/x86_64/Packages/

Yum install a network source

Be finishing

Installing the software environment

yum -y install httpd php mysql mysql-server php-mysql

rpm -qa | grep httpd      #[搜索指定rpm包是否安装]--all搜索httpd

rpm-ivh xxx:安装显示安装进度--install--verbose--hash

yum –y install xxx 使用这个就不会老询问你要不要yes他会自动的同意,也就不需要你老确认

-lt 列出监听的TCP端口, -u 或 --udp 显示UDP传输协议的连线状况,-n 输出中不解析主机、端口、名称, -p 显示进程ID和名称

[root@i-14fe7093 nginx]# netstat -ltunp

安装Nginx

准备编译条件

需要先挂载ISO源 RHEL-7.3 Server.x86_64-2.iso

yum install gcc zlib-devel zlib pcre pcre-devel

yum -y install openssl openssl-devel

编译安装nginx

下载1.12.2

https://nginx.org/en/download.html

复制到/usr/local/nginx

sudo mkdir /usr/local/nginx

cp /mnt/udisk/redhat\redhat7-centos-yum\redhat7-centos-yum-rpm-1/nginx-1.12.2.tar.gz /usr/local/nginx

– 解压Nginx安装包 tar -zxvf nginx-1.12.2.tar.gz – 解压后进入 nginx-1.12.2 目录进行编译安装 ./configure make && make install

nginx命令全局执行设置

cd /usr/local/nginx/sbin/

ln -s /usr/local/nginx/sbin/nginx /usr/local/bin/nginx

查看虚拟机地址

ifconfig

如果没有ens33的ip

关闭防火墙

[root@nginx ~]# firewall-cmd --state running [root@nginx ~]# systemctl stop firewalld.service [root@nginx ~]# firewall-cmd --state not running

启动和停止

ngnix

ngnix -s stop/reload

主机中查看nginx服务

http://192.168.61.128/

如果出现 C compiler not found错误,执行:

yum -y install gcc gcc-c++ autoconf automake make

修改Nginx配置文件以支持PHP解析

nginx配置文件默认放在/etc/nginx/nginx.confvi /etc/nginx/nginx.conf在server区间里加入以下内容
注释掉本来的这两行
server {
      listen       80 default_server;
      listen       [::]:80 default_server;
      server_name _;
      root         /usr/share/nginx/html;
      index index.php index.html index.htm;

      # Load configuration files for the default server block.
      include /etc/nginx/default.d/*.conf;

      location / {
      }

      error_page 404 /404.html;
          location = /40x.html {
      }

      error_page 500 502 503 504 /50x.html;
          location = /50x.html {
      }
      location ~ .php$ {
      try_files $uri =404;
      root /usr/share/nginx/html;
      fastcgi_pass 127.0.0.1:9000;
      fastcgi_index index.php;
      fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
      include fastcgi.conf;
}

}

主要改了2个地方:index 加了index.php;location 加了 php的解析

systemctl restart nginx 重启nginx 或者用 nginx -s reload

在目录/usr/share/nginx/html下新建phpinfo.php文件,内容为 <?php phpinfo();?>

安装PHP

yum install -y php #安装

php -v #验证

安装PHP-FPM

下载地址 http://rpm.pbone.net/index.php3/stat/4/idpl/35040654/dir/scientific_linux_7/com/php-fpm-5.4.16-42.el7.x86_64.rpm.html

cd /mnt/cdrom/Packages

rpm -ivh php-fpm-5.4.16-42.el7.x86_64.rpm

systemctl start php-fpm

ps -ef|grep php-fpm

验证ngnix+php安装

http://192.168.61.128/phpinfo.php

设置自启动

待完整

其他资源

主要参考

https://www.linuxidc.com/Linux/2018-09/154437.htm

redhat网盘资源 iso和学习视频都有

https://pan.baidu.com/s/1skLXnJZ#list/path=%2FRed%20Hat%20Enterprise%20Linux&parentPath=%2F

 

Guess you like

Origin www.cnblogs.com/taylorluo/p/10987569.html