Search This Blog

Labels

adobe (1) android (3) apache (3) aviation (1) bash (2) chrome (2) composer (1) cookery (3) dev (2) dodanperks (1) extensions (1) facebook (2) firefox (1) git (2) grafana (1) guzzle (1) headaches (11) htaccess (1) html5 (2) jquery (2) lamp (1) life hacks (10) linux (28) mysqli (2) native (1) opera (2) php (10) railfanning (1) reactjs (3) reactnative (1) servers (11) sinhala (1) smartphones (2) snap (1) sound (1) tech (22) troubleshoots (4) ubuntu (29) unicode (4) virtualbox (1) wamp (2) web (11) windows (4) wordpress (3) youtube (2) කෑම (3)

Sunday, 29 April 2018

LAMP stack installation on Ubuntu 18.04

For the most of the part these instructions working very well.

Apache2

sudo apt install apache2
But few things to note:

MYSQL

mysql installation does not prompt for a password hence you have to set in via as described in section 5 of this tutorial.

sudo apt update && sudo apt install mysql-server
Check the version to ensure the installtion is done perfectly.
sudo service mysql status 
Run following command to set password and set other secrity measures to the mysql installation as the installtion process doesn't prompt for these.
sudo mysql_secure_installation
And follow the instructions

Turns out you can't use the root user in 5.7 anymore without becoming a sudoer. That means you can't just run
mysql -u root
anymore and have to do
sudo mysql -u root
instead.

That also means that it will no longer work if you're using the root user in a GUI (or supposedly any non-command line application). To make it work you'll have to create a new user with the required privileges and use that instead.


See this answer for more details.

Login to mysql with sudo mysql -u root,
CREATE USER 'some_user'@'localhost' IDENTIFIED BY 'some_pass';
GRANT ALL PRIVILEGES ON *.* TO 'some_user'@'localhost' WITH GRANT OPTION;
FLUSH PRIVILEGES;

Restart mysql if needed,
sudo service mysql restart

PHP 7.0 and 7.2

To install php 7.0 or 7.2 follow the instructions on this tutorial.

Instructions for installing PHP 7.2

sudo apt update && apt-get upgrade
sudo apt install software-properties-common 
sudo add-apt-repository ppa:ondrej/php
sudo apt update
sudo apt install php7.2 
Check the php version
php -v
Install php 7.2 mods
sudo apt install php-pear php7.2-curl php7.2-dev php7.2-gd php7.2-mbstring php7.2-zip php7.2-mysql php7.2-xml 

Finish

Restart the server,
sudo /etc/init.d/apache2 restart

Check if the server runs on http://localhost/ and check if the php installation works as well

No comments:

Post a Comment