Add new user
Reference
https://www.digitalocean.com/community/tutorials/how-to-add-and-delete-users-on-an-ubuntu-14-04-vps
Add new user
adduser username
Grant a user sudo privileges
visudo
Search for the line looks like
root ALL=(ALL:ALL) ALL
and add new line under this line
newuser ALL=(ALL:ALL) ALL
Install Apache
sudo apt-get update
sudo apt-get install apache2
The webserver document root is /var/www/html
, change the owner of this dir and grant write permission to the group
sudo chown -R www-data:www-data /var/www/html
sudo chmod -vR g+w /var/www/html
Add new user to a group
sudo usermod -a -G www-data username
Install MySQL
sudo apt-get install mysql-server php5-mysql
After installation, we need to run some additional commands to get our MySQL environment set up securely.
sudo mysql_install_db
sudo mysql_secure_installation
Install PHP
sudo apt-get install php5 libapache2-mod-php5 php5-mcrypt
List installed php modules
apt-cache search php5-
Enable rewrite module
sudo a2enmod rewrite
service apache2 restart
Other tools to install
Install curl
sudo apt-get install curl
Install php curl
sudo apt-get install php5-curl
Install git
sudo apt-get install git
Install composer
curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer
Import existing database
Create new database, in mysql command line
mysql>CREATE DATABASE IF NOT EXISTS `databasename` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
Import existing database
mysql -u root -ppassword databasename < filename.sql
To allow local/remote connect to database, modify my.conf
and change the line
bind-address = 0.0.0.0
then restart mysql
sudo service mysql restart
Create new user and grant all privilieges on a database. In mysql command line
mysql> CREATE USER ‘username’@'localhost' IDENTIFIED BY ‘password’;
mysql> CREATE USER 'username'@'%' IDENTIFIED BY ‘password’;
mysql> GRANT ALL ON dbname.* TO ‘username’@'localhost';
mysql> GRANT ALL ON dbname.* TO 'username'@'%';