Build a LAMP environment learning record under Ubuntu Server, named ubuntulamp
I have learned some knowledge about linux over the past few days. Here I will record the learning records.
# Stop the mysql service before data migration
$
# Change the user group and user and folder permissions of the target directory to mysql: mysql 0700
$
$
# To prevent exceptions, copy the existing data (cp) to a new directory instead of moving the data (mv). To ensure that the permissions and attributes of the file are consistent, you must add the-a parameter in the copy process, you can view the copy process by adding the-v parameter because the data volume is large.
$
# Edit MySQL configuration file my. cnf
$
# Modify the datadir parameter value in the my. cnf File
Datadir =/data/mysql/
# Edit the apparmor permission configuration file for mysql
$
# Modify the permissions of the data storage directory in the usr. sbin. mysqld File
/Data/mysql/r
/Data/mysql/** rwk
# Restart apparmor after saving AND EXITING
$
# Restart the apparmor permission service process and mysql process
$
Improve practice
Practice Description: Assume that MOOC's video tutorial website belongs to the javastuserver operating system and uses the LAMP environment. Recently, the siege Lions of MOOC have developed two new systems:
1. Student Exchange Forum System (bbs)
2. Staff online Office System (oa)
Now we need to add these two systems to the servers that have stored the MOOC video tutorial website (www.imooc.com, two second-level domain names bbs.imooc.com and oa.imooc.com have been assigned to the new systems, and the domain names have been resolved to the IP addresses of the servers where www.imooc.com is located.
Task requirements: assume that the MOOC video site is currently stored in the/webdata/imooc/www directory, and the currently loaded VM configuration file is/etc/apache2/sites-available/imooc_www. From the perspective that each system does not affect each other and is easy to manage, configure virtual hosts for the two new systems.
Skill points: simple configuration of Apache Virtual Host
Note: $ before a command only indicates the start of a command. Do not enter $ in the actual operation process. # The operation instructions or detailed explanations of the previous command are described below.
As shown in the following figure (write the executed command on the horizontal line as prompted ):
# Create two folders bbs and oa under the/webdata/imooc directory. After executing the preceding commands, the/webdata/imooc directory contains three folders: www, bbs, and oa, the name corresponds to the second-level domain name and stores the PHP files of the three systems, which facilitates future maintenance and management. $ Or execute the command step by step. $ $ # Switch the current directory to the "currently available" configuration directory of the VM $ # Although each virtual host is independent, most configuration items are the same. There is no need to hand-write a new configuration file. You can copy the existing imooc_www configuration file twice and rename it to the root directory of the two new systems, respectively, imooc_bbs and imooc_oa. The configuration file name can be selected at will, but the above name is used for separate and management. $ # Use vim to edit the configuration file $ # The copied configuration file is as follows: <VirtualHost *: 80> ServerName www.imooc.com DocumentRoot/webdata/imooc/www <Directory/> Options FollowSymLinks AllowOverride None </Directory> <Directory/webdata/imooc/www/> Options Indexes FollowSymLinks MultiViews AllowOverride None Order allow, deny Allow from all </Directory> #... The configuration item is omitted here. </VirtualHost> # Change the above marked parameters in red from top to bottom Change www.imooc.com /Change webdata/imooc/www /Webdata/imooc/www/changed # Save and exit, and use the same method to modify the imooc_oa configuration file # Switch the current directory to the "currently enabled" configuration directory of the VM $ # The virtual host has been successfully configured for the bbs.imooc.com and oa.imooc.com new systems. $ $ # Restart apache to make the configuration take effect. $ |