-
-
Save morshedalam/346d6fd0817fdf705224 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Configure MySQL to Listen on Private Network Interface | |
sudo nano /etc/mysql/my.cnf | |
bind-address = db1.nyc3.example.com | |
exit | |
sudo service mysql restart | |
#Login | |
mysql -u root -p | |
#Create Database | |
CREATE DATABASE app; | |
CREATE USER 'hsb_prod'@'localhost' IDENTIFIED BY 'password'; | |
GRANT ALL PRIVILEGES ON app.* TO 'hsb_prod'@'localhost'; | |
FLUSH PRIVILEGES | |
exit |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Install Apache | |
sudo apt-get update | |
sudo apt-get install apache2 | |
#Find your Server's Public IP Address | |
ip addr show eth0 | grep inet | awk '{ print $2; }' | sed 's/\/.*$//' | |
#Test apache running | |
http://your_server_IP_address | |
#Install MySQL | |
sudo apt-get install mysql-server php5-mysql | |
#Create its database directory structure | |
sudo mysql_install_db | |
#Securing DB | |
sudo mysql_secure_installation | |
#Installing LAMP Stack | |
sudo apt-get install lamp-server^ | |
sudo apt-get install libapache2-mod-auth-mysql phpmyadmin | |
#Additional lib for MySql | |
sudo apt-get install libapache2-mod-auth-mysql phpmyadmin | |
#Install PHP | |
sudo apt-get install php5 libapache2-mod-php5 php5-mcrypt | |
#Additional lib for PHP | |
sudo apt-get install php5-curl php5-gd php5-idn php-pear php5-imagick php5-imap php5-memcache php5-mhash php5-ming php5-ps php5-pspell php5-recode php5-snmp php5-tidy php5-xmlrpc php5-xsl php5-json php5-cli | |
#Check additional modules | |
apt-cache search package_name | |
apt-cache show package_name | |
#Configure PHP | |
sudo nano /etc/apache2/mods-enabled/dir.conf | |
#Kept only .php and .html for apache to serve | |
<IfModule mod_dir.c> | |
DirectoryIndex index.php index.html | |
</IfModule> | |
#Add ServerName | |
sudo nano /etc/apache2/apache2.conf | |
#Restart apache server | |
sudo service apache2 restart | |
############################ | |
# OPTIONAL CONFIGURATION # | |
############################ | |
#FQDN | |
echo "ServerName localhost" | sudo tee /etc/apache2/conf.d/fqdn | |
#INI Config | |
sudo find / -name php.ini | |
sudo nano /etc/php5/apache2/php.ini | |
#Apache Config | |
sudo a2enmod rewrite | |
#Change Document Root | |
sudo nano /etc/apache2/sites-available/default | |
sudo service apache2 restart | |
#Change symbolic link | |
sudo rm -r /var/www; sudo ln -s /home/${USER}/www /var/www | |
#Configure ports | |
sudo nnao /etc/apache2/ports.conf | |
Listen private_IP:80 | |
sudo service apache2 restart | |
#Change Group | |
sudo chgrp -R www-data /var/www/html/* | |
#Using different web root directory | |
sudo mkdir /var/apps/project-directory | |
sudo chown -R morshed:www-data apps/ | |
sudo adduser www-data morshed | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Install packages | |
apt-get -y install build-essential libmagickcore-dev imagemagick libmagickwand-dev libxml2-dev libxslt1-dev git-core nginx redis-server curl nodejs htop |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Root Login | |
ssh root@SERVER_IP_ADDRESS | |
#Setup nano editor | |
sudo apt-get install nano | |
#Create a New User | |
adduser demo | |
#Root Privileges | |
gpasswd -a demo sudo | |
#Add Public Key Authentication | |
ssh-keygen | |
#Copy the Public Key | |
cat ~/.ssh/id_rsa.pub | |
#Add Public Key to New Remote User | |
su - demo | |
#Restrict permission | |
mkdir .ssh | |
chmod 700 .ssh | |
#Open .ssh/authorized_keys for authorization | |
nano .ssh/authorized_keys | |
- Paste public key here | |
#Restrict the permissions of the authorized_keys | |
chmod 600 .ssh/authorized_keys | |
exit | |
#Configure SSH as you want | |
nano /etc/ssh/sshd_config | |
Port 22 | |
PermitRootLogin no | |
#Reload SSH | |
service ssh restart | |
#Test SSH before logout using sudo | |
sudo nano /etc/ssh/sshd_config | |
#Updating system | |
apt-get update | |
apt-get -y upgrade | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment