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

Quickly build LAMP environment on CentOS7

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

Share

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

First

Make sure that the network is configured correctly on the CentOS7 and that you can access the Internet properly.

Make sure that iptables is turned off.

On CentOS7 is firewall, close command:

# systemctl stop firewalld.service # stop firewalld service # systemctl disable firewalld.service # set boot does not start by default

Make sure selinux is turned off.

# setenforce 0 # shut down selinux (permissive status) # getenforce # View status # vim / etc/sysconfig/selinux # without rebooting the system

Now let's introduce the process of quickly building LAMP.

1.yum source configuration

Using Aliyun's yum source here, enter:

# wget-O / etc/yum.repos.d/CentOS-Base.repo # yum makecache generation cache

two。 Install Apache

# yum install-y httpd# vim / etc/httpd/conf/httpd.conf # modify the configuration file DirectoryIndex index.html index.php # add index.php after the entry, support index.php home page AddType application/x-httpd-php .ph # add php support # vim / var/www/html/index.php # under the path where the default home page is stored Add index.php 's test file # systemctl start httpd.service # start httpd # systemctl status httpd.service # View running status # ss-ntlp # View listening port # systemctl enable httpd.service # set boot

Note: if you are configuring the LAMP environment of zabbix server, the configuration file

Do not add index.php after DirectoryIndex index.html # item

3. Install MariaDB

# yum install-y mariadb-server # yum install MariaDB, add skip_name_resolve=on # prohibit domain name resolution innodb_file_per_table=on # in the [mysql-safe] section of CentOS6 yum install mysql-server# vim / etc/my.cnf # modify InnoDB to independent tablespace mode # systemctl start mariadb.service# start mariadb# systemctl enable mariadb.service# mysqladmin-u root password 'dtsdts' # create administrator password # mysql_secure_installation # initialize security settings # mysql-uroot-pdtsdts # root user login MariaDB [(none)] > CREATE DATABASE zabbix CHARSET 'utf8'; # create zabbix library. The default character set is utf8MariaDB [(none)] > GRANT ALL ON zabbix.* TO zbxuser@'127.0.0.1' IDENTIFIED BY' zbxpass';MariaDB [(none)] > GRANT ALL ON zabbix.* TO zbxuser@'localhost' IDENTIFIED BY 'zbxpass' # zbxuser can be logged in locally with a password of zbxpass, and have all permissions for zabbix MariaDB [(none)] > GRANT ALL ON zabbix.* TO zbxuser@'10.10.10.%' IDENTIFIED BY 'zbxpass'; # zbxuser can log in from the 10.10.10.0 network segment with password of zbxpass, and have all permissions for zabbix MariaDB [(none)] > flush privileges; # refresh permission

4. Install php

# yum install-y php php-mysql# yum install-y php-gd php-xml php-process php-mbstring php-bcmath # install php extension components

You can modify / etc/php.ini for simple php optimization (unnecessary):

Max_execution_time = 300memory_limit = 128Mpost_max_size = 16Mupload_max_filesize = 2Mmax_input_time = 300date.timezone PRC

5. Test

# restart the service # systemctl restart httpd.service# systemctl restart mariadb.service

Browser access authentication:

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