LAMP
    • PDF

    LAMP

    • PDF

    Article Summary

    Available in Classic

    LAMP is an open source software stack service for web applications named after the first letters of Linux, Apache, MySQL, and PHP. It is automatically configured on NAVER Cloud Platform's Compute infrastructure service and can be instantly put into service through a configuration process with only a few steps.
    The advantages of using LAMP are as follows:

    • You can use a stable web service development platform utilizing the infrastructure services of NAVER Cloud Platform.
    • You can select a server image and specifications to automatically install and use the LAMP stack service.
    Note

    For more information on the software used in NAVER Cloud Platform's LAMP, see the following websites:

    Creating and accessing server

    The method for creating and accessing the server is the same as creating a regular server on NAVER Cloud Platform. The following are detailed procedures and reference guides:

    ProcedureDescription
    1. Set ACG
    • Reference guide: ACG
    • Must set the following ports:
      • TCP 22 port for a terminal connection
      • TCP 80 port for the use of web services (can be changed)
    2. Create server
    • Reference guide: Create server
    • Image type Application, Application image type LAMP
    3. Set public IP
    4. Set port forwarding
    5. Get admin password
    6. Access server
    Note
    • After you access and log in to the server, change the password of the root account to one you can remember. Enter the passwd root command to set a new password.
    • If you can't connect to the server even if there is no problem in the public IP address and ACG, your LAMP process might be stopped. Run the restart command (systemctl start httpd) on the terminal program to restart the process.

    Check LAMP installation

    When the server is created, the LAMP components are automatically installed, so you can use the service immediately. Check if the components are installed successfully through the following methods:

    Access web

    Access the LAMP service through the web, and then check if it is installed successfully. The access URL is http://{public ip address}. If the index page of NAVER Cloud Platform's LAMP is run upon accessing, it is successfully installed.

    Note

    LAMP is set based on HTTP protocol by default. To use a more stable and security-enhanced method, use HTTPS protocol. After you create SSL certificates and web service domains, you can use HTTPS protocol.

    Check installation directory

    Access the server through the terminal program, and then call installation directory and logs to check if it is installed successfully.

    Note

    This guide is based on CentOS 7.8.

    • Check LAMP component installation directory information
    # ls /root/lamp
    conf  lamp_info.sh  lamp_restart.sh  uninstall_lamp_centos.sh
    
    • Check LAMP web root directory information
    # ls /ncp/data/www
    index.html ncp ncp.jquery.js
    
    • Check LAMP installation log
    # cat /var/log/lamp/lamp_install.log
    [Info] Starting Installation NCP LAMP Product...
    [Info] Starting pre-configuration install products...
    [Info] Downloading NCP LAMP Configuration File...
    [Info] NCP LAMP Configuration file download completed.
    [Info] Initializing MySQL root password...
    [Info] Initialized MySQL root password...
    [Info] Removing already installed products...
    
    ...(rest omitted)
    

    Check PHP information

    Create the PHP information file and check if the PHP and PHP modules are installed successfully.

    1. Enter the following command to create the PHP information file.

      echo "<?php phpinfo(); ?>" > /ncp/data/www/phpinfo.php
      
      Note

      When a permission error occurs when running commands, run Change Linux permissions.

    2. Enter http://{public ip address}/phpinfo.php in the web's address window and run it.

    3. View relative information on the LAMP's PHP information page displayed on the web browser.

    4. If you have checked all the information, delete the PHP information file for security reasons. Enter the following commands to delete files.

      rm /ncp/data/www/phpinfo.php
      

    Manage LAMP service

    While you use the service, you can stop running or restart the components manually, or check the components' properties and process.

    Stop/run LAMP components

    When you need to stop or run components manually, enter the following commands:

    • Stop and run all LAMP components
    [root@lamp ~]# LAMP_HOME=/root/lamp
    [root@lamp ~]# $LAMP_HOME/lamp_restart.sh
    
    ---------------------------------------------------------------
    [Info] LAMP Service Re-start
    ---------------------------------------------------------------
    OS Information : CentOS Linux release 7.8.2003 (Core)
    
    ---------------------------------------------------------------
    [NCP LAMP] httpd re-start
    ---------------------------------------------------------------
    [Info] httpd is stopped.
    [Info] httpd is started.
    
    ---------------------------------------------------------------
    [NCP LAMP] mysqld re-start
    ---------------------------------------------------------------
    [Info] mysqld is stopped.
    [Info] mysqld is started.
    
    • Check LAMP component installation status
    [root@lamp ~]# LAMP_HOME=/root/lamp
    [root@lamp ~]# $LAMP_HOME/lamp_info.sh
    
    ---------------------------------------------------------------
    General Information of NCP LAMP Products
    ---------------------------------------------------------------
    
    NCP LAMP Default Website : http://(your_public_ip)
    NCP LAMP Default Root Directory : /ncp/data/www
    NCP LAMP MySQL root init password :(your_server_hostname)
    
    ---------------------------------------------------------------
    [NCP LAMP] HTTPD(Apache) version
    ---------------------------------------------------------------
    Server version: Apache/2.4.6 (CentOS)
    Server built:   Oct  1 2020 16:52:05
    
    ---------------------------------------------------------------
    [NCP LAMP] MySQL Database version
    ---------------------------------------------------------------
    mysql  Ver 14.14 Distrib 5.6.51, for Linux (x86_64) using  EditLine wrapper
    
    ---------------------------------------------------------------
    [NCP LAMP] PHP version
    ---------------------------------------------------------------
    PHP 7.2.34 (cli) (built: Oct  1 2020 13:37:37) ( NTS )
    Copyright (c) 1997-2018 The PHP Group
    Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
    
    • httpd/apache2 servoce Stop and run

      • CentOS 7.x
        • Stop: systemctl stop httpd
        • Run: systemctl start httpd
      • Ubuntu 16.04
        • Stop: systemctl stop apache2
        • Run: systemctl start apache2
    • httpd/apache2 service Check process

      • CentOS
        [root@lamp ~]# ps -ef | grep httpd
        root     11430     1  0 10:57 ?        00:00:00 /usr/sbin/httpd -DFOREGROUND
        apache   11431 11430  0 10:57 ?        00:00:00 /usr/sbin/httpd -DFOREGROUND
        apache   11432 11430  0 10:57 ?        00:00:00 /usr/sbin/httpd -DFOREGROUND
        apache   11433 11430  0 10:57 ?        00:00:00 /usr/sbin/httpd -DFOREGROUND
        apache   11434 11430  0 10:57 ?        00:00:00 /usr/sbin/httpd -DFOREGROUND
        apache   11435 11430  0 10:57 ?        00:00:00 /usr/sbin/httpd -DFOREGROUND
        
      • Ubuntu
        root@lamp-ubuntu:~# ps -ef | grep apache2
        root      2803     1  0 11:19 ?        00:00:00 /usr/sbin/apache2 -k start
        www-data  2806  2803  0 11:19 ?        00:00:00 /usr/sbin/apache2 -k start
        www-data  2807  2803  0 11:19 ?        00:00:00 /usr/sbin/apache2 -k start
        
    • mysqld/mysql service Stop and run

      • CentOS 7.x
        • Stop: systemctl stop mysqld
        • Run: systemctl start mysqld
      • Ubuntu 16.04
        • Stop: systemctl stop mysql
        • Run: systemctl start mysql
    • mysqld/mysql service Check process

      [root@lamp ~]# ps -ef | grep mysqld
      mysql    10063     1  0 10:44 ?        00:00:00 /bin/sh /usr/bin/mysqld_safe --basedir=/usr
      mysql    10316 10063  0 10:44 ?        00:00:01 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin --log-error=lamp.err --pid-file=lamp.pid --socket=/var/lib/mysql/mysql.sock --port=3306
      

    Change MySQL root password

    When you install LAMP, MySQL DB's root password is set as your host name.
    Before you use it, change the password to protect your security.

    Enter the following commands to change the password.

    [root@lamp ~]# mysql_secure_installation
    
    
    NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL
          SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!
    
    In order to log into MySQL to secure it, we'll need the current
    password for the root user.  If you've just installed MySQL, and
    you haven't set the root password yet, the password will be blank,
    so you should just press enter here.
    
    Enter current password for root (enter for none):
    
    ...(rest omitted)
    

    Was this article helpful?

    What's Next
    Changing your password will log you out immediately. Use the new password to log back in.
    First name must have atleast 2 characters. Numbers and special characters are not allowed.
    Last name must have atleast 1 characters. Numbers and special characters are not allowed.
    Enter a valid email
    Enter a valid password
    Your profile has been successfully updated.