Table of contents
Advantages of installing software from source code
Note: Source code compilation environment
Case --- Installing Apache service
1. Obtain the installation package address and download it
2. Unzip the installation package
3. Use ./configure configuration
Error --- said APR is missing, we just use yum to install APR
Error --- pcre(2)-config is missing, use yum again to install it
Error --- make: command not found..
Linux tar installation
definition
The tar command is used to create or restore Linux files and directories as archives. In addition, tar can also change files in the archive or add new files to the archive . This program was originally designed to back up files to tape (Tape ARchive), hence the name tar
work process
Forward --- packaging and compression
Packaging ---turn a large number of files or directories into one total file
Compression ---Convert a large file into a small file through some compression algorithms
Reverse --- decompression and restoration
Syntax format
tar [option] filename.tar.gz source file
Notice:
Package --- xxx.tar
Compression --- xxx.tar.gz
Parameters and usage
parameter | usage |
-c | Create a new archive, i.e. package |
-v | Visualize the process of displaying detailed file information processed by tar |
-f | File name to be operated on |
-x | unzip files |
-z | Compress files through gzip ----File format: xxx.tar.gz |
-j | Archive compressed files via bzip2 --- File format: xxx.tar.bz2 |
-J | Use xz compression tool to compress into .xz file --- file format: xxx.tar.xz |
-t | Indicates viewing the file content in the file |
-C | Decompress to the specified directory, decompress to the current directory without adding -C |
Advantages of installing software from source code
- Get the latest software version and fix bugs in a timely manner
- Flexibly customize software functions according to user needs
Note: Source code compilation environment
A compiler that supports C/C++ programming language needs to be installed
Operating procedures
Unpack - tar
Unpack and release source code files
Configuration - ./configure
Compile - make
Install - make install
Case --- Installing Apache service
1. Obtain the installation package address and download it
Enter Welcome! - The Apache HTTP Server Project to find the httpd software package
At this time, you can choose to download it locally and then transfer it to the LInux virtual machine through Xhell, or use the wget link address to download in the virtual machine.
[root@joker test]# wget https://dlcdn.apache.org/httpd/httpd-2.4.57.tar.gz
2. Unzip the installation package
[root@joker apache]# tar -xvf httpd-2.4.57.tar.gz
3. Use ./configure configuration
Enter the folder and find an executable file named configure. Use ./configure configuration to set the installation directory, installation module and other options.
–prefix=/xx/xx/xx (/xx/xx/xx is the software installation path, just like Windows asking you where the software is installed)
[root@joker local]# ./configure --prefix=/test/apache/
Error --- said APR is missing, we just use yum to install APR
Because I don’t know which apr is missing, I install them all.
[root@joker httpd-2.4.57]# yum install -y apr*
Execute ./configure --prefix=/test/apache/ again
Error --- pcre(2)-config is missing, use yum again to install it
[root@joker httpd-2.4.57]# yum install -y pcre*
Execute ./configure --prefix=/test/apache/ again
4.make compile
Execute the make command directly in the folder to compile
Purpose:
make compile --- to generate executable binary files
[root@joker httpd-2.4.57]# make
Error --- make: command not found..
Generally, this -bash: make: command not found prompt appears because the minimum mini installation is used when installing the system . The system does not have common commands such as make and vim installed . Just install it directly with yum install make .
[root@joker httpd-2.4.57]# yum install make
Execute make again
5.make install installation
[root@joker httpd-2.4.57]# make install
6. Test
Move to the installation directory /test/apache/ and find that there will be a bin directory
[root@joker httpd-2.4.57]# cd /test/apache/
[root@joker apache]# ls
Enter the bin directory and find that there will be two executable files: httpd and apachcetl . You can execute them separately.
[root@joker apache]# cd bin/
[root@joker bin]# ls
Execute two files
[root@joker bin]# ./httpd
[root@joker bin]# ./apachectl
Turn off firewall
[root@joker bin]# setenforce 0
[root@joker bin]# systemctl stop firewalld
Test access URL