Skip to content

Instantly share code, notes, and snippets.

@peter279k
Last active February 21, 2018 13:59
Show Gist options
  • Save peter279k/b86aaa82c3eaafd77a84b4c67fe2680d to your computer and use it in GitHub Desktop.
Save peter279k/b86aaa82c3eaafd77a84b4c67fe2680d to your computer and use it in GitHub Desktop.
Ubuntu 14.04 LAMP server installation
#!/bin/bash
# Prerequisite
# You should run the initial_ubuntu.sh script before running this bash script file.
sudo apt-get update
sudo apt-get install dialog tasksel software-properties-common
sudo tasksel install lamp-server
# upgrade the PHP 5.5.9 to PHP 7
sudo add-apt-repository ppa:ondrej/php
# upgrade the MySQL 5.5 to MySQL 5.7
wget http://dev.mysql.com/get/mysql-apt-config_0.8.0-1_all.deb
# The following command will ask for input:
# see more details: https://askubuntu.com/questions/750498/mysql-5-5-update-to-mysql-5-7
# Notice: I choose the MySQL 5.6 because the MySQL 5.7 encounter some unexpected problems.
sudo dpkg -i mysql-apt-config_0.8.0-1_all.deb
# update the packages repo url
sudo apt-get update
# intall the required packages
sudo apt-get install php7.0
sudo apt-get install php7.0-mysql
sudo apt-get install mysql-server
sudo mysql_upgrade -u root -p
sudo service mysql restart
# MySQL server need the logger package during starting the MySQL service.
# If not, it will encounter: " mysqld_safe --syslog requested, but no 'logger' program found. Please ensure that 'logger' is in your PATH, or do not specify the --syslog option to mysqld_safe" error.
sudo apt-get install bsdutils
# solve the MySQL server error: MySQL 5.6 No directory, logging in with HOME=/
sudo service mysql stop
sudo chown mysql /var/run/mysqld
sudo usermod -d /var/lib/mysql/ mysql
sudo service mysql start
# If you use the Apache server
# Disable php5 Apache module then enable php7 Apache module
sudo a2dismod php5
sudo service apache2 restart
sudo a2enmod php7.0
# If you want to install additional extension for the PHP 7
# You have to refer the following commands.
sudo apt-get update
sudo apt-get install php7.0-curl php7.0-mbstring php7.0-mcrypt
# enable the module in PHP cli
sudo phpenmod mcrypt
sudo phpenmod mbstring
sudo phpenmod curl
# After installing the required PHP extensions, you should restart the Apache service.
# Then the PHP module will successfully load in PHP Apache modules.
sudo service apache2 restart
# pgsql installation
# sudo apt-get install postgresql
# sudo apt-get install libpq-dev
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment