Apache offline installation and ab test

Versions after Apache 2.4 no longer come with APR library, so before installing Apache, you need to install the following dependent tools: 1. apr 2. apr-util 3. pcre (recommended to use yum to install)

1. Preparation

1. Related downloads of apr and apr-util

Official website address: http://apr.apache.org/

Download address: http://apr.apache.org/download.cgi

Find the installation package and download: apr-1.7.0.tar.gz, apr-util-1.6.1.tar.gz

2. pcre related downloads

Official website address: http://pcre.org/

Download address: https://ftp.pcre.org/pub/pcre/

Find the installation package and download: pcre-8.39.tar.gz

3. Apache related downloads

Official website address: http://httpd.apache.org/

Download address: http://httpd.apache.org/download.cgi#apache24

Find the installation package and download it: https://mirrors.bfsu.edu.cn/apache//httpd/httpd-2.4.48.tar.gz

4、expat

Download address https://launchpad.net/ubuntu/+source/expat/2.0.1-7.2ubuntu1.4

Find the installation package and download: expat_2.0.1.orig.tar.gz

2. Install dependent tools and Apache

Upload all the above files to the Linux server and enter the file storage path.

1. Unzip all files

Execute the command: cd /{file storage path}

tar -zxvf apr-1.7.0.tar.gz -C /usr/local

tar -zxvf apr-util-1.6.1.tar.gz -C /usr/local

tar -zxvf pcre-8.39.tar.gz -C /usr/local

tar -zxvf httpd-2.4.48.tar.bz -C /usr/local

tar -zxvf expat_2.0.1.orig.tar.gz -C /usr/local

2. Install apr

Execute the command: cd /usr/local/apr-1.7.0

./configure --prefix=/usr/local/apr make&&make install

3. Install expat

cd /usr/local/expat-2.0.1

./configure make&&make install

4. Install apr-util

Execute the command: cd /usr/local/apr-util-1.6.1

./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr make&&make install

5. Install Apache

cd /usr/local/httpd-2.4.48

./configure --prefix=/usr/local/apache2/ --with-apr=/usr/local/apr/ --with-aprutil=/usr/local/apr-util/ --with-pcre=/usr/bin/ make&&make install

3. Apache start and stop commands

⚫ Start Apache command:

Installation path: /usr/local/apache2/bin

./ab -c1000 -n100000 http://IP/

/usr/local/apache2/bin/apachectl start

/usr/local/apache2/bin/apachectl stop

/usr/local/apache2/bin/apachectl restart

./ab -n 10 -c 10 -p test.txt -T application/x-www-form-urlencoded http://IP/

Apache's default port is port 80, if the port is occupied, you need to change the configuration file. After starting, visit http://{server ip}:{port}, and the words Is Works! appear, indicating that Apache has been successfully installed.

⚫ View apache running status

Command: ps -ef | grep httpd ulimit -a is used to display the current various user process limits ulimit -u 10000 sets the maximum number of processes for linux users to 10000, which is convenient for ab testing

Fourth, log in to check apache

1. Windows check

⚫ Browser login apache address + port number + /

2. Linux check

⚫ curl ipv4: port number +/ such as: crul IPV4: 80

⚫ curl [ipv6]: port number +/ -g such as: curl [IPV6]:80/ -g

Guess you like

Origin blog.csdn.net/dqz1231/article/details/127947373