As the first article to get started on Linux, most of this article will be downright unfriendly to beginners. But I still want to write in this way, the reason is very simple, for engineering, not to us to master how much basic theoretical knowledge, but in practice !!!! —–bike

RPM package and Source Code

For Linux systems, we take centos, which is commonly used as open source, as an example. There are two types: RPM package and source package. Redhat Package Manager (RPM) is a program used by Red Hat Linux distributions to manage various Linux packages. It is popular because it complies with GPL rules and has powerful and convenient functions. Increasingly adopted by other distributions, RPM packages generally end in.rpm and are binary packages that can be installed directly into the system. Source code package is our common high-level language written project code, because it is high-level language written, so our computer is completely do not understand, we need to compile and install their own.

Rounding out the RPM

1. What you need to know about RPM packages

Wget-1.14-15.el7.x86_64. RPM: this is a common Linux software, function similar to thunderbolt. Well, instead of focusing on functionality, let’s look at the package, which is roughly divided into five parts: WGET, the name of the package; 1.14-15, the software version number EL7, refers to the release version enterprise Linux 7; X86_64, system bit; RPM: indicates the suffix of the RPM package.

2. You can manage RPM packages in two modes: yum and RPM

2.1 yum tools

Yum (Yellow Dog Modified) is a Shell front-end package manager in Fedora, RedHat, and CentOS. Based on RPM package management, RPM packages can be automatically downloaded and installed from a specified server, and dependencies can be automatically handled. In addition, all dependent software packages can be installed at a time without tedious downloading and installation.

2.1.1 Prepare a centos system. Please search for how to install centos, because it is too simple.

2.1.2 Before starting the VM, ensure that the VM Settings have been successfully set to CD/DVD as shown in the following figure

2.1.3 Start the system and log in to the centos system as user root

2.1.4 Configuring and Using the Local YUM Source

#Go to the yum source directory
[root@localhost ~]# cd /etc/yum.repos.d/
[root@localhost yum.repos.d]# ls -l
#The following is the initial yum source displayed by using the ls -l command
#The total amount of 32
#-rw-r--r--. 1 root root 1664 September 5 2019 centos-base
#-rw-r--r--. 1 root root 1309 September 5 2019 centos-cr. repo
#-rw-r--r-- 1 root root 649 September 5 2019 centos-debuginfo. repo
#-rw-r--r--. 1 root root 314 September 5 2019 centos-fasttrack. repo
#-rw-r--r--. 1 root root 630 September 5 2019 centos-media.repo
#-rw-r--r--. 1 root root 1331 9月 5 2019 centos-sources.repo
#-rw-r--r-- 1 root root 6639 September 5 2019 centos-vault.repo[root@localhost yum. Repos. D]# tar -cvf repo.tar * # [root@localhost yum. Repos. D]# ls -l # Check the tar command execution status#The total amount of 52
#-rw-r--r--. 1 root root 20480 December 6 00:21 repo.tar[root@localhost yum. Repos. D]# mv repo.tar/TMP / # Move to another directory [root@localhost yum. Repos. D]# rm -rf * # Delete all files in current directory [root@localhost yum. Repos. D]# vim local.repo ##Write the following:
[local]
name=LocalRepository
baseurl=file:///mnt/cdrom
gpgcheck=0
#### Explanation of the above ####[local] # yum yum yum yum yum yum yum yum yum yum yum yum yum yum yum yum yum yum yum yum yum yum yum yum yum yum yum yum yum yum## # # # # # # # # # # # # # # # # # # # # # # # # # # #[root@localhost yum. Repos. D]# mkdir/MNT /cdrom # create system CD mount directory [root@localhost yum#Write the following:
mount /dev/cdrom /mnt/cdrom
## # # # # # # # # # # # # # # # # # # # # # # # # # # #[root@localhost ~]# ls/MNT /cdrom/#The following is the system disk information displayed by using the ls command
CentOS_BuildTag  EULA  images    LiveOS    repodata              RPM-GPG-KEY-CentOS-Testing-7
EFI              GPL   isolinux  Packages  RPM-GPG-KEY-CentOS-7  TRANS.TBL
## # # # # # # # # # # # # # # # # # # # # # # # # # #[root@localhost ~]# yum -y install HTTPD # root@localhost ~]# systemctl start HTTPD # [root@localhost ~]# systemctl stop firewalldCopy the code

Enter a value in the VM browser127.0.0.1Or enter the IP address in the local browser when the VM is networkedThe virtual machine IPIf the following information is displayed, the Apache is successfully installed.

2.1.5 Configuring Other Yum Sources (163Yum Source is used as an example)

Ensure that the VM is connected to the Internet before performing this operation

[root@localhost yum.repos.d]# yum install wget -y
[root@localhost yum.repos.d]# mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
[root@localhost yum.repos.d]# wget http://mirrors.163.com/.help/CentOS7-Base-163.repo
[root@localhost yum.repos.d]# yum clean all
[root@localhost yum.repos.d]# yum makecache
[root@localhost yum.repos.d]# yum repolist 
#The plug-in fastestMirror has been loaded
# Loading mirror speeds from cached hostfile
#Source ID Indicates the status of the source name
#Base /7/x86_64 centos-7-BASE-163.com
#extras/7/x86_64 CentOS-7 - Extras - 163.com 448
#updates/7/x86_64 CentOS-7 - Updates - 163.com 775
#Repolist: 11295
Copy the code

2.1.6 Managing RPM Packages in YUM Mode

Install: yum install

View: yum list [software] # which followed @ for the installed software | | yum repolist # to check the yum source

Install: yum remove

# yum update [yum update] # yum update [yum update] # yum update

2.2 RPM tools

Red hat /centos system management, RPM package basic tool, and YUM functions the same. Advantages You do not need to configure and can directly use them. The disadvantages are also obvious, such as the inability to resolve dependencies and download packages on your own. 2.2.1 Using Basic Commands

Install: RPM -ivh [software name] #

RPM -q [software name] #

Uninstall: RPM -evh

3. Source code package management

Before installation, we need to download the source code package from the official website of the corresponding software. The following uses Tengine as an example:

Note: Tengine, HTTPD, and nginx are the same product and cannot be enabled on the same machine at the same time, so please disable other web services before installing Tengine!!

Wget/root @ localhost ~ # # http://tengine.taobao.org/download/tengine-2.3.2.tar.gz to download the source code package/root @ localhost ~ # tar - xf [root@localhost ~]# yum -y install GCC make zlib-devel pcre pcre-devel openssl-devel # Provide a compilation environment for software installation [root@localhost ~]# CD tenine-2.3.2 [root@localhost tenine-2.3.2]#./configure --prefix=/usr/local/tengine # configuration, [root@localhost tengane-2.3.2]# make # compile [root@localhost tengane-2.3.2]# make install # install [root@localhost # / usr/local/sbin] tengine/sbin/nginx/root @ localhost ~ # # start systemctl stop firewalld # close the firewallCopy the code

Enter a value in the VM browser127.0.0.1Or enter the IP address in the local browser when the VM is networkedThe virtual machine IPIf the following screen is displayed, Tengine is successfully installed.


It will be supplemented and modified later