Home > Database > Mysql Tutorial > How to install Apache and Mysql in CentOS6

How to install Apache and Mysql in CentOS6

WBOY
Release: 2023-05-28 20:37:21
forward
1393 people have browsed it

1. Install apache

Enter the following command in the terminal to install apache:

sudo yum install httpd
Copy after login

sudo means what to do with the root user. Just click y to confirm the download and installation, which is very convenient.
Then use the following command to start the service

sudo service httpd start
Copy after login

Don't worry about it now, just enter the IP address digitalocean gave you in the browser, and you should be able to access the apache welcome page. Something like this:

How to install Apache and Mysql in CentOS6

# Isn’t it cool? If your domain name has been successfully resolved to the IP address of your host, you should be able to access it using your domain name!

2. Install mysql

sudo yum install mysql-server
sudo service mysqld start
Copy after login

Use the above command to download and install mysql. The second one means to start the mysql service.
When you install mysql, you will be asked for some simple configurations. Press enter first. The following ones are actually very simple in English. You can choose according to your own needs.
disallow root login remotely? There is an option to allow the root user of mysql to access remotely. I chose no and it can be accessed. This is more convenient, but there are security risks. In this way, the database in this vps can also be used when making software later.

3. Install php and php components

sudo yum install php php-mysql
Copy after login

Use the above command to download and install php. What is more troublesome is the PHP component.

yum install php-gd php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc
Copy after login

I simply installed 7 components here. You can also search for all PHP components and use the following command

yum search php-
Copy after login

4. Start the apache and mysql services by default after booting up

sudo chkconfig httpd on
sudo chkconfig mysqld on
Copy after login

You can use the above two commands to choose to start apache and mysql at boot.

5. Test whether php is installed successfully

sudo nano /var/www/html/info.php
Copy after login

You can use the above commands to create a new info.php file , nano is a simple text editing tool, and vim.
Enter a simple test php command:

<?php
phpinfo();
?>
Copy after login

Then enter ctrl o to save, and click Enter to confirm. Then enter ctrl x to exit.
Then in the browser, enter the IP address plus info.php, you can see the php information! Similar to the picture below:

How to install Apache and Mysql in CentOS6

The above is the detailed content of How to install Apache and Mysql in CentOS6. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:yisu.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template