How To Install LAMP stack On Arch Linux
To Install LAMP stack On Arch Linux
LAMP Stands for Linux, Apache, MySQL, MariaDB, MongoDB, PHP, PERL, PYTHON, PhpMyAdmin. LAMP is a server configuration for various web applications. It helps in running servers and dynamic web sites. It is a web development platform that uses Linux operating system, Apache web server, MySQL relational database management system and PHP scripting language. This article covers the method to install LAMP Stack on Arch Linux.
Installing LAMP
Installing Apache
You shall install the Apache service by making use of the following command.
[root@linuxhelp11 ~]# pacman -S apache resolving dependencies... looking for conflicting packages... Packages (3) apr-1.6.3-1 apr-util-1.6.1-1 apache-2.4.29-1 Total Installed Size: 7.22 MiB :: Proceed with installation? [Y/n] y (3/3) checking keys in keyring [#####################] 100% (3/3) checking package integrity [#####################] 100% (3/3) loading package files [#####################] 100% (3/3) checking for file conflicts [#####################] 100% (3/3) checking available disk space [#####################] 100% :: Processing package changes... (1/3) installing apr [#####################] 100% (2/3) installing apr-util [#####################] 100% Optional dependencies for apr-util gdbm: enable gdbm support [installed] libldap: enable ldap support [installed] unixodbc: enable odbc support libmariadbclient: enable mysql/mariadb support postgresql-libs: enable postgres support db: enable berkley db support [installed] sqlite: enable sqlite support [installed] nss: enable nss crypto support [installed] openssl: enable openssl crypto support [installed] (3/3) installing apache [#####################] 100% Optional dependencies for apache lua: for mod_lua module [installed] libxml2: for mod_proxy_html, mod_xml2enc modules [installed] lynx: apachectl status :: Running post-transaction hooks... (1/2) Creating temporary files... (2/2) Arming ConditionNeedsUpdate...
Once the Apache service is installed, you shall configure it, so open the conf file and search the mod_unique id and uncomment it.
root@linuxhelp11 ~]# nano /etc/httpd/conf/httpd.conf . . #LoadModule unique_id_module modules/mod_unique_id.so . . After that, you need to start the Apache service. root@linuxhelp11 ~]# systemctl start httpd
And then, you need to create a new index.html file in apache root directory for testing apache. Run the following command for the same purpose.
[root@linuxhelp11 ~]# nano /srv/http/index.html
< html>
< title> Welcome< /title>
< body>
< h2> Welcome to Linuxhelp< /h2>
< /body>
< /html>
Install MySQL
You shall now proceed with the installation of MySQL and for that, you need to run the following command.
[root@linuxhelp11 ~]# pacman -S mysql :: There are 2 providers available for mysql: :: Repository extra 1) mariadb :: Repository community 2) percona-server Enter a number (default=1): 1 resolving dependencies... looking for conflicting packages... Packages (5) jemalloc-1:5.0.1-3 libevent-2.1.8-1 libmariadbclient-10.1.29-1 mariadb-clients-10.1.29-1 mariadb-10.1.29-1 Total Installed Size: 234.22 MiB :: Proceed with installation? [Y/n] (5/5) checking keys in keyring [#####################] 100% (5/5) checking package integrity [#####################] 100% (5/5) loading package files [#####################] 100% (5/5) checking for file conflicts [#####################] 100% (5/5) checking available disk space [#####################] 100% :: Processing package changes... (1/5) installing libmariadbclient [#####################] 100% (2/5) installing jemalloc [#####################] 100% Optional dependencies for jemalloc perl: for jeprof [installed] (3/5) installing mariadb-clients [#####################] 100% (4/5) installing libevent [#####################] 100% Optional dependencies for libevent python2: to use event_rpcgen.py [installed] (5/5) installing mariadb [#####################] 100% :: You need to initialize the MariaDB data directory prior to starting the service. This can be done with mysql_install_db command, e.g.: mysql_install_db --user=mysql --basedir=/usr --datadir=/var/lib/mysql Optional dependencies for mariadb galera: for MariaDB cluster with Galera WSREP perl-dbd-mysql: for mysqlhotcopy, mysql_convert_table_format and mysql_setpermission :: Running post-transaction hooks... (1/3) Updating system user accounts... (2/3) Creating temporary files... (3/3) Arming ConditionNeedsUpdate...
Once MySQL is installed, you shall start it by triggering the following command.
[root@linuxhelp11 ~]# systemctl start mysqld
After that, run the mysql secure installation command.
[root@linuxhelp11 ~]# mysql_secure_installation NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS 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 current password for the root user. If you' ve just installed MariaDB, 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): OK, successfully used password, moving on... Setting the root password ensures that nobody can log into the MariaDB root user without the proper authorisation. You already have a root password set, so you can safely answer ' n' . Change the root password? [Y/n] y New password: Re-enter new password: Password updated successfully! Reloading privilege tables.. ... Success! By default, a MariaDB installation has an anonymous user, allowing anyone to log into MariaDB without having to have a user account created for them. This is intended only for testing, and to make the installation go a bit smoother. You should remove them before moving into a production environment. Remove anonymous users? [Y/n] y ... Success! Normally, root should only be allowed to connect from ' localhost' . This ensures that someone cannot guess at the root password from the network. Disallow root login remotely? [Y/n] y ... Success! By default, MariaDB comes with a database named ' test' that anyone can access. This is also intended only for testing, and should be removed before moving into a production environment. Remove test database and access to it? [Y/n] y - Dropping test database... ... Success! - Removing privileges on test database... ... Success! Reloading the privilege tables will ensure that all changes made so far will take effect immediately. Reload privilege tables now? [Y/n] y ... Success! Cleaning up... All done! If you' ve completed all of the above steps, your MariaDB installation should now be secure. Thanks for using MariaDB!
After installation of MySQL, you need to enter into your MySQL database and make necessary configuration.
[root@linuxhelp11 ~]# mysql -u root -p
Enter password:
Welcome to the MariaDB monitor. Commands end with or g.
Your MariaDB connection id is 20
Server version: 10.1.29-MariaDB MariaDB Server
Copyright (c) 2000, 2017, Oracle, MariaDB Corporation Ab and others.
Type ' help ' or ' h' for help. Type ' c' to clear the current input statement.
MariaDB [(none)]>
MariaDB [(none)]> q
Bye
Installing PHP
You shall go on with the installation of PHP by making use of the following command.
[root@linuxhelp11 ~]# pacman -S php php-apache resolving dependencies... looking for conflicting packages... Packages (2) php-7.2.0-2 php-apache-7.2.0-2 Total Installed Size: 31.95 MiB Net Upgrade Size: 12.53 MiB :: Proceed with installation? [Y/n] y (2/2) checking keys in keyring [#####################] 100% (2/2) checking package integrity [#####################] 100% (2/2) loading package files [#####################] 100% (2/2) checking for file conflicts [#####################] 100% (2/2) checking available disk space [#####################] 100% :: Processing package changes... (1/2) reinstalling php [#####################] 100% (2/2) installing php-apache [#####################] 100% :: Running post-transaction hooks... (1/1) Arming ConditionNeedsUpdate...
Later, you need to configure Apache to enable the PHP module.
[root@linuxhelp11 ~]# nano /etc/httpd/conf/httpd.conf
Find the following line and comment it out:
[...]
#LoadModule mpm_event_module modules/mod_mpm_event.so
[...]
add the following lines at the bottom:
[...]
LoadModule mpm_prefork_module modules/mod_mpm_prefork.so
LoadModule php7_module modules/libphp7.so
AddHandler php7-script php
Include conf/extra/php7_module.conf
After that, you should create a new test.php file in theapache root directory for testing php. Run the following command for the same purpose.
[root@linuxhelp11 ~]# nano /srv/http/test.php
< ?php
phpinfo()
?>
Once all of it is done, you shall restart the Apache service.
[root@linuxhelp11 ~]# systemctl restart httpd
Now, open the browser, and give http://localhost as your URL. The Apache page you’ ve configured gets opened.
And to test PHP, you should give http://localhost/test.php as your URL. All the modules that are installed in the machine is displayed.
With this, the installation of LAMP stack on Arch Linux.
Comments ( 0 )
No comments available