Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to build LAMP Environment through RPM installation by Linux

2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

What this article shares with you is about how Linux builds the LAMP environment through RPM installation. The editor thinks it is very practical, so I share it with you to learn. I hope you can get something after reading this article.

LAMP is a dynamic website environment built by Linux+Apache+MySql+ PHP, and it is a very popular web service combination on the Internet.

There are many tutorials on the Internet to build the LAMP environment, which are basically compiled and installed. In fact, for beginners, they only need to know some features of the LAMP environment. RMP installation is relatively easy to start, and you only need to install a few CD-ROM installation packages to successfully complete the construction of LAMP.

Install Apache

[root@linux-a] # rpm-ivh / media/Server/httpd-2.2.3-6.el5.i386.rpm

Warning: / media/Server/httpd-2.2.3-6.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186

Error: Failed dependencies:

Libapr-1.so.0 is needed by httpd-2.2.3-6.el5.i386

Libaprutil-1.so.0 is needed by httpd-2.2.3-6.el5.i386

[root@linux-a ~] #

Hint requires libapr-1.so.0 and libaprutil-1.so.0 support

Install libapr-1.so.0

[root@linux-a] # rpm-ivh / media/Server/apr-1.2.7-11.i386.rpm

Warning: / media/Server/apr-1.2.7-11.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186

Preparing... # [100%]

1:apr # # [100%]

Apr-util-1.2.7-6.i386.rpm needs the support of postgresql-libs

Install libpq.so.4

[root@linux-a] # rpm-ivh / media/Server/postgresql-libs-8.1.4-1.1.i386.rpm

Warning: / media/Server/postgresql-libs-8.1.4-1.1.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186

Preparing... # [100%]

1:postgresql-libs # # [100%]

[root@linux-a ~] #

Install libaprutil-1.so.0

[root@linux-a] # rpm-ivh / media/Server/apr-util-1.2.7-6.i386.rpm

Warning: / media/Server/apr-util-1.2.7-6.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186

Preparing... # [100%]

1:apr-util # # [100%]

[root@linux-a ~] #

Install Apache

[root@linux-a] # rpm-ivh / media/Server/httpd-2.2.3-6.el5.i386.rpm

Warning: / media/Server/httpd-2.2.3-6.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186

Preparing... # [100%]

1:httpd # # [100%]

[root@linux-a ~] #

Install MySql

Mysql requires the support of perl (DBI) and perl-DBD-MySQL, so install perl-DBI and perl-DBD-MySQL first

Perl-DBI installation

[root@linux-a] # rpm-ivh / media/Server/perl-DBI-1.52-1.fc6.i386.rpm

Warning: / media/Server/perl-DBI-1.52-1.fc6.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186

Preparing... # [100%]

1:perl-DBI # # [100%]

[root@linux-a ~] #

Perl-DBD-MySQL installation

[root@linux-a] # rpm-ivh / media/Server/perl-DBD-MySQL-3.0007-1.fc6.i386.rpm

Warning: / media/Server/perl-DBD-MySQL-3.0007-1.fc6.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186

Preparing... # [100%]

1:perl-DBD-MySQL # # [100%]

[root@linux-a ~] #

Start installing mysql

[root@linux-a] # rpm-ivh / media/Server/mysql-5.0.22-2.1.i386.rpm

Warning: / media/Server/mysql-5.0.22-2.1.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186

Preparing... # [100%]

1:mysql # # [100%]

[root@linux-a ~] #

Install mysql server

[root@linux-a] # rpm-ivh / media/Server/mysql-server-5.0.22-2.1.i386.rpm

Warning: / media/Server/mysql-server-5.0.22-2.1.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186

Preparing... # [100%]

1:mysql-server # # [100%]

[root@linux-a ~] #

Initialize the MySql database

[root@linux-a ~] # mysql_install_db

Installing all prepared tables

Fill help tables

To start mysqld at boot time you have to copy support-files/mysql.server

To the right place for your system

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER!

To do so, start the server, then issue the following commands:

/ usr/bin/mysqladmin-u root password' new-password'

/ usr/bin/mysqladmin-u root-h linux-a.test.com password' new-password'

See the manual for more instructions.

You can start the MySQL daemon with:

Cd / usr; / usr/bin/mysqld_safe &

You can test the MySQL daemon with the benchmarks in the 'sql-bench' directory:

Cd sql-bench; perl run-all-tests

Please report any problems with the / usr/bin/mysqlbug script!

The latest information about MySQL is available on the web at

Http://www.mysql.com

Support MySQL by buying support/licenses at http://shop.mysql.com

[root@linux-a ~] #

Modify mysql configuration file

[root@linux-a ~] # cp / usr/share/doc/mysql-server-5.0.22/my-medium.cnf / etc/my.cnf

For more settings, please see [installation, configuration and simple Operation of MySql Database under Redhat Linux]

Install php

PHP needs the support of libgmp.so.3, php-cli and php-common.

[root@linux-a] # rpm-ivh / media/Server/ php-5.1.6-5.el5.i386.rpm

Warning: / media/Server/ php-5.1.6-5.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186

Error: Failed dependencies:

Libgmp.so.3 is needed by php-5.1.6-5.el5.i386

Php-cli = 5.1.6-5.el5 is needed by php-5.1.6-5.el5.i386

Php-common = 5.1.6-5.el5 is needed by php-5.1.6-5.el5.i386

Libgmp.so.3 installation

[root@linux-a] # rpm-ivh / media/Server/gmp-4.1.4-10.el5.i386.rpm

Warning: / media/Server/gmp-4.1.4-10.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186

Preparing... # [100%]

1:gmp # # [100%]

Install php-common

[root@linux-a] # rpm-ivh / media/Server/ php-common-5.1.6-5.el5.i386.rpm

Warning: / media/Server/ php-common-5.1.6-5.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186

Preparing... # [100%]

1: php-common #

[root@linux-a ~] #

Install php-cli

[root@linux-a] # rpm-ivh / media/Server/ php-cli-5.1.6-5.el5.i386.rpm

Warning: / media/Server/ php-cli-5.1.6-5.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186

Preparing... # [100%]

1: php-cli #

[root@linux-a ~] #

Install PHP

[root@linux-a] # rpm-ivh / media/Server/ php-5.1.6-5.el5.i386.rpm

Warning: / media/Server/ php-5.1.6-5.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186

Preparing... # [100%]

1: php #

[root@linux-a ~] #

In addition, PHP-MySql needs to be installed, and PHP-MySql needs the support of php-pdo

Install php-pdo

[root@linux-a] # rpm-ivh / media/Server/ php-pdo-5.1.6-5.el5.i386.rpm

Warning: / media/Server/ php-pdo-5.1.6-5.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186

Preparing... # [100%]

1: php-pdo #

[root@linux-a ~] #

Install PHP-MySql

[root@linux-a] # rpm-ivh / media/Server/ php-mysql-5.1.6-5.el5.i386.rpm

Warning: / media/Server/ php-mysql-5.1.6-5.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186

Preparing... # [100%]

1: php-mysql #

[root@linux-a ~] #

Test the configuration:

After installation, the Apache configuration file basically does not need to be modified in / etc/httpd/conf/httpd.conf. For more information, please see [Apache2 configuration File httpd.conf Chinese version (transfer)].

After compiling and installing php, you need to manually modify the configuration file of Apache. There is no need to modify it here. When you install PHP, you will generate a / etc/httpd/conf.d/ php.conf file, and the Apache configuration file can drink this configuration directly.

#

# PHP is an HTML-embedded scripting language which attempts to make it

# easy for developers to write dynamically generated webpages.

#

LoadModule php5_module modules/libphp5.so

#

# Cause the PHP interpreter to handle files with a. Php extension.

#

AddHandler php5-script .php

AddType text/html .php

#

# Add index. Php to the list of files that will be served as directory

# indexes.

#

DirectoryIndex index.php

#

# Uncomment the following line to allow PHP to pretty-print. Phps

# files as PHP source code:

#

# AddType application/x-httpd- php-source. Phps

If you are compiling the installation, you only need to add the red text above to the / etc/httpd/conf.d/ php.conf configuration document.

The configuration file for php is in / etc/ php.ini and does not need to be modified unless you need to configure some advanced features.

The configuration file for MySql is in / etc/my.cnf.

Start the Apache and MySql services

Create a php test file in the web directory, and if the correct php environment information appears, the installation is successful.

[root@linux-a] # vim / var/www/html/index. Php

Upload a WordPress program to the / var/www/html/ directory, change the permissions of its directory to 777, and test the WordPress installation, so that a LAMP environment is set up.

This is how Linux builds the LAMP environment through RPM installation. The editor believes that there are some knowledge points that we may see or use in our daily work. I hope you can learn more from this article. For more details, please follow the industry information channel.

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.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report