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

CentOS 7 builds LAMP step by step

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

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

I. Prepare the environment

1. System version

[root@Webserver01 ~]# cat /proc/version

Linux version 3.10.0-514.16.1.el7.x86_64

2. Close the firewall

[root@Webserver01 ~]# systemctl disable firewalld

3. Prepare yum source

[root@Webserver01 ~]# rpm -ivh http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-5.noarch.rpm

or

[root@Webserver01 ~]# rpm -ivh http://mirrors.aliyun.com/epel/epel-release-latest-7.noarch.rpm

4. Install basic tools

[root@Webserver01 ~]# yum install -y net-tools vim lrzsz tree screen lsof tcpdump nc nmap

Turn off SELINUX

[root@Webserver01 ~]# vim /etc/sysconfig/selinux SELINUX=disabled

Update and restart

[root@Webserver01 ~]# yum update -y && reboot

Second, start installing LAMP

LAMP requires at least the following components:

httpd (provides Apache main program)

mysql (MySQL client program)

mysql-server (MySQL server program)

php (PHP main program contains modules for apache)

php-devel (PHP development tool, this is related to PHP plug-in acceleration software)

php-mysql (module provided for PHP programs to read MySQL databases)

You can install it once with the following command:

[root@Webserver01 ~]# yum install httpd mysql mysql-server php php-mysql

To see more details, we install them one by one

Install Apache with yum command

[root@Webserver01 ~]# yum -y install httpd

Start httpd and set it to boot

[root@Webserver01 ~]# systemctl start httpd.service[root@Webserver01 ~]# systemctl enable httpd.service

Enter the URL to view the test page

2. Install Mariadb

Use the yum command to install and configure boot. Also use the yum command to install and configure boot.

[root@Webserver01 ~]# yum -y install mariadb-server mariadb[root@Webserver01 ~]# systemctl start mariadb.service[root@Webserver01 ~]# systemctl enable mariadb.service

Configure root password

[root@Webserver01 ~]# mysql_secure_installation There will be several options during the installation process. You can configure them according to your own needs. Enter current password for root (enter for none):(Enter the original root password, if there is no enter) OK, successfully used password, moving on... Setting the root password ensures that nobody can log into the MariaDBroot user without the proper authorisation. Set root password? [Y/n] New password:Re-enter new password:Password updated successfully! Reloading privilege tables.. ... Success! Remove anonymous users? [Y/n](Remove anonymous users)... Success! Disallow root login remotely? [Y/n](Remote root login disabled)... skipping.Remove test database and access to it? [Y/n] Reload privilege tables now? [Y/n](reload)... Success! Cleaning up... All done! If you've completed all of the above steps, your MariaDBinstallation should now be secure.Thanks for using MariaDB!

Log in to the database and test it.

[root@Webserver01 ~]# mysql -u root -pEnter password: Welcome to the MariaDB monitor. Commands end with ; or \g.Your MariaDB connection id is 13Server version: 5.5.52-MariaDB MariaDB ServerCopyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.MariaDB [(none)]> show databases;+--------------------+| Database |+--------------------+| information_schema || mysql || performance_schema |+--------------------+3 rows in set (0.00 sec)MariaDB [(none)]> exitBye

3. Install PHP

[root@Webserver01 ~]# yum -y install php

Install required components

[root@Webserver01 ~]# yum -y install php-mysql php-gd php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-snmp php-soap curl curl-devel

Start the service and set it to boot automatically

[root@Webserver01 ~]# systemctl start httpd.service[root@Webserver01 ~]# systemctl enable httpd.service

Check whether ports 80 and 3306 are listening:

[root@Webserver01 ~]# netstat -ntlp

Test whether PHP works properly.

Edit the file/etc/httpd/conf/httpd.conf, fill in index.php after DirectoryIndex, and define the default homepage as index.php

[root@Webserver01 ~]# vim /etc/httpd/conf/httpd.conf

overloaded httpd profile

[root@Webserver01 ~]# systemctl reload httpd.service[root@Webserver01 ~]# vim /var/www/html/index.php

The requested URL/html/index.php was not found on this server.

This is new Web !

Restart httpd service

[root@Webserver01 ~]# systemctl restart httpd.service

All right, so the test finally worked.

Open http://x.x/info.php to view

See this page, we can call it a day, LAMP environment construction is over!

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

Database

Wechat

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

12
Report