ubuntu17.10 installing lamp and deploying PHP probe system

Source: Internet
Author: User

ubuntu17.10 Change Password and install lamp and deploy PHP probe system Step 1: ubuntu17.10 Configuration IP (this version of the configuration IP change is large, apt-get upgrade update to the latest previous configuration method can also be used)

[Email protected]:~# Vi/etc/netplan/01-netcfg.yaml

# This file describes the network interfaces available on your system# For more information, see Netplan (5). network:vers Ion:2 renderer:networkd Ethernets:ens32:dhcp4:no dhcp6:no addresses: [192.168.10.222/24] Ga teway4:192.168.10.1 nameservers:addresses: [61.134.1.5, 114.114.114.114]

The configuration changes are saved after the command is executed for the configuration to take effect:

[Email protected]:~# Netplan Apply

Step 2: Install Apache Web Server

Enter the following command to install the Apache Web server. The Apache2-utils package will install some useful utilities, such as the Apache HTTP Server benchmark tool (AB).

[Email protected]:~# sudo apt install-y apache2 apache2-utils

After the installation is complete, Apache should be started automatically. Use Systemctl to check its status.

[Email protected]:~# systemctl status Apache2.service apache2.service-the Apache HTTP Server   loaded:loaded (/lib/s Ystemd/system/apache2.service; Enabled Vendor Preset:  drop-in:/LIB/SYSTEMD/SYSTEM/APACHE2.SERVICE.D           └─apache2-systemd.conf   active:active ( Running) since Mon 2018-01-22 22:14:47 EST; 1min 52s ago Main pid:21380 (apache2)    tasks:55 (limit:4915)   memory:4.9m      cpu:179ms   CGroup:/system.sli Ce/apache2.service           ├─21380/usr/sbin/apache2-k start           ├─21382/usr/sbin/apache2-k start           └─21383/usr/ Sbin/apache2-k Startjan 22:14:47 Ubuntu systemd[1]: Starting the Apache HTTP Server ...  Jan 22:14:47 ubuntu apachectl[21360]: AH00558:apache2:Could not reliably DeJan (22:14:47 ubuntu systemd[1]: Started The Apache HTTP Server.

If it is not running, start it with Systemctl. Enabling Apache to start automatically is also a good way

[Email protected]:~# sudo systemctl start apache2[email protected]:~# sudo systemctl enable apache2synchronizing State of Apache2.service with SysV service script With/lib/systemd/systemd-sysv-install. Executing:/lib/systemd/systemd-sysv-install Enable Apache2

  

After startup, the browser tests whether IP can open access

Now we need to set the Www-data (Apache user) as the owner of the document root directory. By default, it is owned by the root user.

[Email protected]:~# sudo chown www-data:www-data/var/www/html/-R
Step 3: Install the MariaDB database server

MARIADB is a replacement for MySQL. Enter the following command to install it on Ubuntu 17.10.

[Email protected]:~# sudo apt install mariadb-server mariadb-clientreading Package lists ... Donebuilding dependency treereading state information ... Donethe following additional packages would be installed:  galera-3 libaio1 Libcgi-fast-perl Libcgi-pm-perl Libdbd-mysql-perl  libdbi-perl libencode-locale-perl libfcgi-perl libhtml-parser-perl  Libhtml-tagset-perl Libhtml-template-perl libhttp-date-perl  Libhttp-message-perl Libio-html-perl Libjemalloc1 Liblwp-mediatypes-perl

After the installation is complete, the MARIADB server should be turned on automatically. Use Systemctl to check its status.

[email protected]:~# systemctl start mariadb [email protected]:~# systemctl enable MARIADB//boot auto auto [email& nbsp;protected]:~# systemctl status mariadb mariadb.service-mariadb 10.1.30 database server loaded:loaded (/lib/syst Emd/system/mariadb.service; Enabled Vendor Preset:Active:active (running) since Mon 2018-01-22 22:34:51 EST; 5s ago Docs:man:mysqld (8) https://mariadb.com/kb/en/library/systemd/Process:23372 execstartpost=/bin/sh -C systemctl unset-environment _wsrep_sta process:23368 execstartpost=/etc/mysql/debian-start (code=exited, status=0/ SU process:23254 execstartpre=/bin/sh-c [!-e/usr/bin/galera_recovery] && VA process:23246 execstartpre=/b In/sh-c systemctl unset-environment _wsrep_star process:23237 execstartpre=/usr/bin/install-m 755-o mysql-g root-d    /VAR/R Main pid:23341 (mysqld) Status: "Taking your SQL requests now ..." Tasks:26 (limit:4915) memory:59.2m cpu:464ms CGroup:/system.slice/maRiadb.service└─23341/usr/sbin/mysqldjan 22:34:50 Ubuntu systemd[1]: Starting MariaDB 10.1.30 database serve R...  Jan 22:34:50 ubuntu mysqld[23341]: 2018-01-22 22:34:50 139684071342016 [Note]jan 22:34:51 ubuntu systemd[1]: Started MariaDB 10.1.30 database server.

Now run the post-installation security script.

sudo mysql_secure_installation

When it asks you to enter the mariadb root password, press Enter because the root password has not been set. Then enter Y to set the root password for the MARIADB server.

[Email protected]:~# sudo mysql_secure_installationnote:running all PARTS of this SCRIPT are RECOMMENDED for all mariadb
   servers in PRODUCTION use!  Please READ each STEP carefully! In order to log into MariaDB to secure it, we'll need the CurrentPassword for the root user.  If you ' ve just installed MariaDB, Andyou Haven ' t set the root password yet, the password would be a blank,so you should just Press ENTER here. Enter current password to root (enter for none): OK, successfully used password, moving on ... Setting The root password ensures that nobody can log into the Mariadbroot user without the proper authorisation. Set root Password? [y/n] ynew password:re-enter new password:# #后面的设置选项按需选择即可

By default, the MARAIDB package on Ubuntu uses Unix_socket to authenticate user logins, which basically means you can log on to the MARIADB console using the operating system's user name and password. Therefore, you can run the following command to log on without providing the mariadb root password.

[Email protected]:~# sudo mariadb-u rootwelcome to the MARIADB Monitor.  Commands End With; or \g.your MariaDB connection ID is 10Server version:10.1.30-mariadb-0ubuntu0.17.10.1 Ubuntu 17.10Copyright (c) 2000, 201 7, Oracle, MariaDB Corporation Ab and others. Type ' help ', ' or ' \h ' for help. Type ' \c ' to clear the current input statement. MariaDB [(none)]> Exitbye
Step 4: Install PHP7.1

At the time of writing, PHP7.1 is the latest stable version of PHP and has a small performance advantage on PHP7.0. Enter the following command to install PHP7.1.

[email protected]:~# sudo apt install php7.1 libapache2-mod-php7.1 php7.1-mysql Php-common php7.1-cli Php7.1-common Php7.1-json php7.1-opcache php7.1-readlinereading Package lists ... Donebuilding dependency treereading state information ... donesuggested packages:php-pearthe following NEW packages would be installed:libapache2-mod-php7.1 Php-common php7.1 ph P7.1-CLI Php7.1-common Php7.1-json php7.1-mysql php7.1-opcache PHP7.1-READLINE0 upgraded, 9 newly installed, 0 to remove and 3 not upgraded. Need to get 3,783 KB of archives. After this operation, 15.0 MB of additional disk space would be used. Get:1 Http://us.archive.ubuntu.com/ubuntu artful/main amd64 php-common all 1:54UBUNTU1 [12.1 kb]get:2/HTTP/ Us.archive.ubuntu.com/ubuntu artful-updates/main amd64 php7.1-common amd64 7.1.11-0ubuntu0.17.10.1 [836 kB]Get:3 http ://us.archive.ubuntu.com/ubuntu artful-updates/main amd64 php7.1-json amd64 7.1.11-0ubuntu0.17.10.1 [17.5 kB]Get:4 Http://us.archive.ubuntu.com/ubuntu artful-updates/main AMD64 php7.1-opcache amd64 7.1.11-0ubuntu0.17.10.1 [146 KB] 

Enable the Apache php7.1 module, and then restart the Apache Web server.

[Email protected]:~# sudo a2enmod php7.1considering dependency mpm_prefork for php7.1:considering conflict mpm_event for M Pm_prefork:considering conflict Mpm_worker for Mpm_prefork:module Mpm_prefork already enabledconsidering conflict php5 For Php7.1:module php7.1 already enabled[email protected]:~# sudo systemctl restart apache2[email protected]:~# php--vers ionphp 7.1.11-0ubuntu0.17.10.1 (CLI) (Built:nov 1 16:30:52) (NTS) Copyright (c) 1997-2017 the PHP groupzend Engine v3.1.0, Copyright (c) 1998-2017 Zend technologieswith Zend opcache v7.1.11-0ubuntu0.17.10.1, Copyright (c) 1999-2017, by Z End Technologies

To test PHP scripts using the Apache server, we need to create a info.php file in the document root directory.

[Email protected]:~# sudo vi/var/www/html/info.php

Paste the following PHP code into the file.

<?php phpinfo ();?>

By the way, test the probe, put the tz.php in the/var/www/html/directory

The UBUNTU17.10 Web environment is now OK!!!

ubuntu17.10 installing lamp and deploying PHP probe system

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.