LAMP is a common web service architecture run on Linux and consisting of Apache, MySQL/MariaDB, and PHP. This article describes how to set up LAMP on a Linux CVM.
You should be familiar with common Linux commands, such as Installing Software via YUM in a CentOS Environment, and understand the versions of the installed software.
These are the software involved:
You need a Linux CVM. If you have not purchased one yet, see Getting Started with Linux CVMs.
Log in to a Linux instance using WebShell (recommended). You can also use other login methods that you are comfortable with:
yum install httpd -y
systemctl start httpd
systemctl enable httpd
The following appears if Apache is installed properly:
Public IP address of the CVM instance][
rpm -qa | grep -i mariadb
yum -y remove [Package name]
# MariaDB 10.4 CentOS repository list - created 2019-11-05 11:56 UTC # http://downloads.mariadb.org/mariadb/repositories/ [mariadb] name = MariaDB baseurl = http://yum.mariadb.org/10.4/centos7-amd64 gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB gpgcheck=1
For installation information for other versions, visit the MariaDB official website.
yum -y install MariaDB-client MariaDB-server
systemctl start mariadb
systemctl enable mariadb
If the following appears, MariaDB is successfully installed.
rpm -Uvh https://mirrors.cloud.tencent.com/epel/epel-release-latest-7.noarch.rpm
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
yum -y install php70w php70w-opcache php70w-mbstring php70w-gd php70w-xml php70w-pear php70w-fpm php70w-mysql php70w-pdo
ServerName www.example.com:80and start a new line below it. Input the following:
Require all deniedin
<Directory>and change it to
Require all granted.
<IfModule dir_module>and change the content to
DirectoryIndex index.php index.html.
AddType application/x-gzip .gz .tgzand input the following:
AddType application/x-httpd-php .php AddType application/x-httpd-php-source .phps
systemctl restart httpd
echo "<?php phpinfo(); ?>" >> /var/www/html/index.php
If the following appears, the LAMP environment is configured successfully.
http://CVM Public IP/index.php
After the LAMP environment is built, you can manually set up Drupal website.
If you encounter a problem when using CVM, refer to the following documents for troubleshooting based on your actual situation.