Last update at :2024-05-19,Edit by888u
Centos is very simple and straightforward: yum install -y httpd php php-fpm mysql mysql-server php-mysql
This means the installation is successful
2. Start the corresponding service
The software we installed such as apache php mysql are all in the form of services in the server. Note that the web services we usually refer to here refer to apache, not the server itself
service httpd start service mysqld start service php-fpm start
After entering these three commands, it means that the website environment has basically been completed. Next, execute netstat -tunlp to check the running status of the service
In this way we can see that httpd (that is, the apache service) listens to port 80, mysql listens to port 3306, and php-fpm listens to port 9000, and they have all been started normally
At this time, our environment has been basically set up. You can already access the external IP of the server in the browser. If you can see the apache test page, it means you have succeeded. To be on the safe side, it is also recommended that you enter the web root directory of Apache: /var/www/html and write the simplest PHP page yourself
cd /var/www/html touch test.php vi test.php After entering the control mode, press the keyboard letter i to enter the editing mode, copy and paste the following code into the editing mode
Then press esc on the keyboard in edit mode to exit edit mode and return to control mode. Press : (colon shift+;) on the keyboard in control mode, then enter wq and press Enter. You can execute the cat test.php command again. When you see the picture below, it means that the test.php file has been edited successfully
You can access the external IP/test.php in the browser and see the following page, then you have completed 80% of the environment setup
3. The last 20% of the problems come from the simple configuration of mysql
Because the discuz forum uses the mysql database, we need to set up a corresponding user for mysql to access management. We have already started the mysqld service before, so at this time we need to set an initial root password for mysql, which allows Root user accesses the database
mysqladmin -u root password “XXXXXXXX”
In this way, we have set the mysql password. You can enter mysql -u root -p, and then enter the password you just set to enter the database. This means that you have fully configured the LAMP environment. , the next step is to upload the code and start building the website.
Recommended site search: Wanwang domain name space, American independent host, foreign virtual host, Hong Kong server defense, Hong Kong server recommendation, host server rental, domain name check, virtual space free trial, German server, vps dynamic ip server, < /p>
发表评论