The entire process of deploying the LAMP environment without the root permission in linux

Source: Internet
Author: User

I. Preface

Although I have been tossing Linux for a long time, I know the installation methods of various software. The two most commonly used installation methods are to download the source code, compile, install, and install with apt-get. The first one is usually a relatively new program, and the latter is relatively stable. Different methods are used for different requirements. In the above method, when the permissions are insufficient, the solution is to use sudo to escalate the permission to the root user, and do everything. Because it is your own computer, you are almost one user, so when we do that, we almost never think about it. Naturally, there will be no problems in our system. One of the hidden problems here is that most of the users playing linux games need to work. Since it is a job, in a collective linux environment, they must not have the root permission, some users only have all operation permissions on their files + good users have the read permission on others' things. Therefore, it is dangerous to blindly escalate the permissions when encountering permission problems. Now I finally understand that when I took a UNIX course at school, the teacher said that you 'd better not use root to operate your system. At that time, I was still thinking that I didn't use root to operate the system, but I am wrong, because I still use root to solve the permission problem directly.

After coming to the company recently, the first thing to do is to deploy the LAMP environment on the company's development machine, and you have no other permissions. The entire mysql, apache, and php source code compilation and installation process is really a headache, so we should avoid further tangle. Here we will make a record and hope that students with the same requirements can learn from each other. Next, go to the topic and deploy the LAMP environment without the root permission.

Ii. source code list

The first step to deploy the LMAP environment is to obtain the source code, which can be downloaded on its official website. Here I will provide a list of the source code versions I used this time,

Note that some modules are missing when installing mysq, apache, and php. Therefore, installing these modules together is critical to the dependency between software, the following installation sequence is also important. This sequence is a better installation sequence after testing.

Iii. Install MySQL

The cmake tool used to install mysql. Therefore, you need to install cmake now.

1. Install cmake

Enter the decompressed directory of cmake and enter the command: $. /configure-prefix =/home/cy/lamp/cmake/(-- prefix is the installation path you need). This step is to generate the makefile file,

Enter $ make. After make is successful, execute make install,

2. Install MySQL

There is no configure file in the mysql directory, so we need to use cmake to generate the makefile file, because many parameters are required to generate the makefile file, therefore, write a shell script to encapsulate configure,

In the Mysql_install.sh script, the makefile file is generated as a required parameter and the content is

Then execute the script to generate the makefile file ,,

After the script is executed, the makefile file is generated and $ make is input. When make is successful,

Enter $ make install. Mysql has been installed. However, after the installation of mysql is complete, there will be further work to be processed. Now, go to the script directory under the mysql installation directory and enter

$. /Mysql_install_db -- user = cy -- basedir =/home/cy/lamp/mysql -- datadir =/home/cy/lamp/mysql/data the user here is your current login user, basedir is the installation path of mysql, and datadir is the data storage path of mysql. Run this command and enter the support-files directory in the mysql installation directory. Enter,

Indicates that mysql has been successfully started. Now you can test it in the Mysql bin directory,

The next step is to add mysql to the environment variable. because mysql is often used, it is too troublesome to go to the installation directory every time. Therefore, add mysql to the environment variable, under. bashrc or. bash_profile ,,

After changing the environment variable, restart the terminal. Then, set the password for the root user of Mysql. His default initial password is blank. Therefore, you can set the password as follows,

Indicates that the password set for mysql is cy. Now you can use the root user to re-enter mysql .,

For more information, click the next page!
  • Three pages in total:
  • Previous Page
  • 1
  • 2
  • 3
  • Next Page

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.