Created
November 23, 2015 23:07
-
-
Save macmladen/e71d2132b5ff67dfd56c to your computer and use it in GitHub Desktop.
Build local environment for development
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
## Always, before performing any installation, make sure that system is up to date: | |
# Freshen information on versions of system software packages | |
sudo apt-get update | |
# Perform upgrade of packages | |
sudo apt-get upgrade | |
# Perform upgrade of system (kernel) | |
sudo apt-get dist-upgrade | |
## Getting to know system | |
# To discovery unix name (uname) with all data (-a) | |
uname -a | |
# Status + or - for all services, to see if apache/httpd, mysql are running | |
service --status-all | |
# print working directory (current) | |
pwd | |
# List all files, including hidden ones | |
ls -al | |
# Make short alias for frequently used commands | |
alias ll="ls -al" | |
# Check active running programs, CPU and memory footprint | |
top | |
# List all active processes | |
ps aux | |
# ...and separate only those with word apache (pipe output of one to input of second command) | |
ps aux | grep apa | |
# Get list of all previous commands | |
history | |
# Print system variable $PATH with active search path and then | |
# substitute each : with new line (for easier reading) | |
echo $PATH | tr ":" "\n" | |
# In case of high load in 'top' of 'kidle_inject' process, remove powerclamp | |
sudo rmmod intel-powerclamp | |
# We should try this for permanent solution | |
echo "blacklist intel_powerclamp" > /etc/modprobe.d/disable-powerclamp.conf | |
## Setting LAMP (Apache, MySQL, PHP) | |
# Install apache web server | |
sudo apt-get install apache2 | |
# Install mysql server | |
sudo apt-get install mysql-server | |
# This is important for live server but not for local development but it does not hurt either | |
sudo mysql_secure_installation | |
# Install PHP with all libraries | |
sudo apt-get install php5 libapache2-mod-php5 php-pear php5-mysql php5-gd php5-mcrypt php5-xdebug | |
# Check php version | |
php -v | |
# If you wish to see complete php configuration | |
php -i | |
# Install composer that is needed for drush that controls Drupal from terminal | |
curl -sS https://getcomposer.org/installer | php | |
# Move composer to proper location | |
sudo mv composer.phar /usr/local/bin/composer | |
# Add export from below to the end of .bashrc | |
nano .bashrc | |
# and also export it as we need it | |
export PATH="$HOME/.composer/vendor/bin:$PATH" | |
# Let composer install drush | |
composer global require drush/drush | |
# check if it is here | |
drush | |
# Alias like old 'nix commands | |
alias dr="drush" | |
## Make configuration files | |
# Make name 'drupal.loc' resolving to localhost - add text in echo to the end of file | |
sudo nano /etc/hosts | |
echo ' | |
127.0.0.1 drupal.loc | |
' | |
# Create Apache virtual server | |
cd /etc/apache2/sites-enabled | |
sudo nano ../sites-available/drupal.loc.conf | |
echo ' | |
<VirtualHost *:80> | |
ServerAdmin [email protected] | |
ServerName drupal.loc | |
ServerAlias www.drupal.loc | |
DocumentRoot /srv/drupal.loc/public_html/ | |
ErrorLog /srv/drupal.loc/logs/error.log | |
CustomLog /srv/drupal.loc/logs/access.log combined | |
<Directory /srv/drupal.loc/public_html/> | |
Require all granted | |
Options +FollowSymLinks -Indexes | |
AllowOverride All | |
order allow,deny | |
allow from all | |
</Directory> | |
</VirtualHost> | |
' | |
sudo ln -s /etc/apache2/sites-available/drupal.loc.conf | |
# Configure xdebug for PHP | |
sudo nano /etc/php5/apache2/php.ini | |
echo ' | |
# Added for xdebug | |
zend_extension="/usr/lib/php5/20100525/xdebug.so" | |
xdebug.remote_enable=1 | |
xdebug.remote_handler=dbgp xdebug.remote_mode=req | |
xdebug.remote_host=127.0.0.1 xdebug.remote_port=9000 | |
' | |
# Make directories for site. Location for sites on server is /srv | |
sudo mkdir /srv/drupal.loc | |
cd /srv/drupal.loc/ | |
sudo chmod 777 . | |
mkdir logs | |
chmod 777 logs | |
# Get drupal version 7 using drush | |
drush dl drupal-7 | |
# change drupal-7.41 to (almost standard) public_html | |
sudo mv drupal-7.41 public_html | |
# enable server to write to default, default site in Drupal | |
chmod -R 777 public_html/sites/default | |
# Lets make a site in one simple command - exchange 'jeca' for | |
# your root password for mysql you entered in installation | |
# The last password is password to login to site in browser | |
drush si --db-su=root --db-su-pw=jeca --db-url=mysql://root:jeca@localhost/drupal --account-pass=jeca | |
# Restart server to apply all modules and configuration changes | |
sudo apachectl graceful | |
# Check configuration of virtual hosts and apache | |
apachectl -S | |
# If you need to test if PHP on server is working | |
sudo nano /srv/drupal.loc/public_html/info.php | |
echo ' | |
<?php phpinfo(); ?> | |
' | |
# Remove when not needed | |
sudo rm /srv/drupal.loc/public_html/info.php | |
## Set up applications | |
# Set up PHPStorm | |
# Get back home | |
cd | |
# First we need Java because PHPStorm is developed in Java | |
sudo apt-get purge openjdk* | |
sudo add-apt-repository ppa:webupd8team/java | |
sudo apt-get update | |
sudo apt-get install oracle-java7-installer | |
# Get PHPStorm | |
# Start script to finish installation | |
wget http://download.jetbrains.com/webide/PhpStorm-9.0.2.tar.gz | |
tar zxf PhpStorm-9.0.2.tar.gz | |
PhpStorm-141.2462/bin/phpstorm.sh |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment