In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
What are the installation and testing steps of httpd source code in CentOS? aiming at this problem, this article introduces the corresponding analysis and solution in detail, hoping to help more partners who want to solve this problem to find a more simple and feasible method.
Environment: CentOS6.4 x86o64
Required applications: APR (http://apr.apache.org/), APR-UTIL (http://apr.apache.org/), httpd)
There are two main types of software installation in Linux, one is package installation, the other is source code installation. Package installation refers to packaging the compiled binaries into rpm packages, which can be installed directly using rpm tools and yum tools. Source code installation refers to those that are not compiled into binary and need to be compiled manually. There are two reasons for using source code installation, one is to use the latest version of the software, and the other is to customize its functionality.
To install the source code:
Expand the compressed files and generally extract the files into / uer/local/src. Use the. / configure option in the extracted files directory to detect the compilation environment, generate makefiel files and use make to compile the make install installation.
Here's how to install httpd and test it from source code in CentOS.
The first step to install software with source code is to install the corresponding compilation environment in the system; the tools needed to build the compilation environment in RedHat are DevelopmentLibraries, Development Tools, Legacy Software Development and X Software Development, which are indispensable in RehdHat. There are two main development tools needed in CentOS, AdditionalDevelopment and Development tools. Therefore, it is necessary to build a compilation environment when installing the source code.
So first of all, we need to mount our CD and find the package group we want to install through the CD. The command to mount the CD is: mount / dev/cdrom / media/cdrom after the CD is successfully mounted, we can query the package group we need through yum-- disablerepo=\ *-- enablerepo=c6-media grouplist. Through the query, we found two necessary development package groups as circled in the figure. So install the two package groups, using the command yum-disablerepo=\ *-- enablerepo=c6-media groupinstall "AdditionalDevelopment"Development tools"
After the installation is complete, then install httpd. You need to install apr and apr-util before installing httpd.
Here we use apr-1.4.6.tar.gz, apr-util-1.5.1.tar.gz, and httpd-2.4.4.tar.bz2 as examples; first extract these compressed files to the / usr/local/src directory, using the command
Decompress three compressed files
After unzipping, go to the / usr/local/src directory to find the directory formed by the three files we just extracted.
Install apr first, then go to the / usr/local/src/apr-1.4.6 directory first
You can see a configure file that we use to configure options and detect the compilation environment. There is also a README or INSTALL file that tells us some ways to use it. Now let's execute configure, add-- prefix to specify the installation directory, and use it by typing. / configure-prefix=/usr/local/apr (this directory is specified by yourself. If you want to uninstall the software later, you can delete it directly. By default, it is installed in / desired/path/of/apr. If you want to uninstall using the default installation path, it will be troublesome.) if there is no error in this process, it means you can move on to the next step.
And then use make to compile.
Make is a long process, waiting patiently is
At this point, it means that the compilation is complete, and then use make install to install it.
When we're done, let's take a look in the / usr/local/ directory.
We have seen the apr we just installed, go back to the apr directory and have a look
We can look at some bin directories, include directories and lib directories.
If we want other software to use apr's library, we need to create a .conf file in the / etc/ld.so.conf.d/ directory to indicate its library path, so let's create a file
After the creation is completed, we write the path in the file.
Then use the ldconfig command to flush the cache
You can see that it's already loaded.
If you want the program to call the header file of apr, we will create a link in / usr/include to / usr/local/apr/include/apr-1
Change to / usr/include directory
You can see many header files in this directory
Then create a link
Through the query, we can see the link we just created.
All right, now that apr has been installed, it's time to install apr-util
First change to the / usr/local/src/apr-util-1.5.1 directory
Configure and README files are also seen in this directory.
Next, just like the previous apr method, execute. / configure-- prefix=/usr/local/apr-util does not work, of course, it will not prompt an error. We need to point out the full path of apr-config, and the path of apr-config is in the / usr/local/apr/bin directory, so it should be written as. / configure-- prefix=/usr/local/apr-util-- with-apr=/usr/local/apr/bin/apr-config.
After passing the test, execute make
Next, install.
After the installation is complete, specify the library file path as in the previous apr
Also refresh the cache
Next, specify the header file.
Create successfully, and finally install httpd
Switch to / usr/local/src/httpd-2.4.4
By looking at it, you can see that there is configure INSTALL README, and then you will execute. / configure--prefix=/usr/local/httpd, of course, this certainly won't work. Here we need to point out the full path of apr-config and the full path of apu-config, so it should be written as. / configure--prefix=/usr/local/apache-- with-apr=/usr/local/apr/bin/apr-config-- with-apr-util=/usr/local/apr-util/bin/apu-config.
After execution, if we see this error,
This is an error about prce-config; to eliminate the error, first check to see if there is any prce-related software installed on the system
Pcre-7.8-6.el6.x86_64 is installed here, so you need to see if there are any files related to pcre-config in this software.
If you find that there is no file about pcre-config, you should install pecr-devel.
After the installation is complete, install httpd so that it passes the test smoothly and then executes make
Execute makeinstall after the completion of make
And then specify the header file.
There are executable files in the / usr/local/apache/bin directory, which is troublesome if you want to change to that directory every time you want to execute. Modify the environment variable / etc/profile if you want to execute it directly
The PATH search path in the system is indicated in 55, and we indicate the current search path here.
This is fine. Use it. / etc/profile re-read, and then use echo to output the value of PATH to see if it has been loaded
You can see from the picture that it has been loaded.
Then point out the location of httpd's man manual, edit / etc/man.config
Just add MANPATH / usr/local/apache/man to it.
Now that httpd is installed, it's time to write shell scripts to control the start and stop of httpd.
The script is stored in / etc/init.d, so we create a httpd control script in it to control the startup of the httpd service.
Code for the script:
#! / bin/bash [- e / etc/init.d/functions] & &. / etc/init.d/functions prog=/usr/local/apache/bin/httpd lockfile=/var/lock/subsys/httpd start () {if [- e $lockfile]; then echo "httpd server isstarted" else echo-n "httpd server isstarting..." Sleep 1$ prog & > / dev/null & & echo "[ok]" & & touch $lockfile | | echo "[failer]" fi} stop () {if [!-e $lockfile]; then echo "httpd server is stoped" else echo-n "httpd server isstoping..." Sleep 1 killproc httpd & & echo "[ok]" & & rm-rf $lockfile | | echo "[failer]" fi} status () {if [- e $lockfile]; then echo "httpd server isstarted" else echo "httpd server nofound" fi} case $1 in start) start;; stop) stop;; restart) stop start;; status) status;; *) echo "USAGE:start | stop | restart | status"; esac
Start the service:
By viewing port 80, we found that httpd has been started.
This shows that our httpd was successfully installed from the source code, and there were no errors in the test.
The answer to the question about the installation and testing steps of the httpd source code in CentOS is shared here. I hope the above content can be of some help to you. If you still have a lot of doubts to be solved, you can follow the industry information channel to learn more about it.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.