Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save alexcodenet/7805956 to your computer and use it in GitHub Desktop.

Select an option

Save alexcodenet/7805956 to your computer and use it in GitHub Desktop.
My fork of https://gist.github.com/DaRaFF/3995789, which describes the full cycle LAMP installation on Ubuntu 13.10 Saucy Salamander.

#Introduction If you're a PHP developer on Ubuntu 13.10, there comes the time where you have to install/reinstall your system. I did it already a few times and i decided to write down the steps for a typical web developer stack with PHP. This is for a developer machine and not for a live environment!

I hope it helps you too!

#Installation stack

#Installation LAMP Environment ##Apache2

sudo apt-get install apache2
sudo apt-get install libapache2-mod-php5
sudo a2enmod rewrite

##PHP5

sudo apt-get install php5-cli php5-common php5 php5-dev

##MySQL

sudo apt-get install mysql-server
sudo apt-get install php5-mysql

#Installation PHP QA Environment ##PHPUnit

sudo pear channel-discover pear.phpunit.de
sudo pear update-channels
sudo pear upgrade-all
sudo pear config-set auto_discover 1
sudo pear install --alldeps pear.phpunit.de/PHPUnit
sudo pear install --force --alldeps pear.phpunit.de/PHPUnit

#phpunit extensions

sudo pear install pear.phpunit.de/PHPUnit_SkeletonGenerator
sudo pear install pear.phpunit.de/DbUnit
sudo pear install --force phpunit/PHPUnit_MockObject

##xDebug

sudo apt-get install php5-xdebug

*edit /etc/php5/mods-available/xdebug.ini

zend_extension=/usr/lib/php5/YOUR_DIR/xdebug.so
xdebug.remote_enable=on
xdebug.remote_host=localhost
xdebug.remote_handler=dbgp
xdebug.remote_port=9000
xdebug.idekey="netbeans-xdebug"

#GitHub support ##Git

sudo apt-get install git
git config --global user.name "NewUser"
git config --global user.email newuser@example.com

#SSH

mkdir /home/username/.ssh
cd .ssh
ssh-keygen -t rsa -C "your_email@example.com"
//specify your current location
ssh-add id_rsa
ssh -T git@github.com
//if "The authenticity of host 'github.com' can't be established." error
//start ssh-agent
env | grep ^SSH
exec ssh-agent bash
ssh-add id_rsa
//if netbeans reports an error ssh-key permission denied
cp ~/.ssh/id_rsa /home/username/GitHubProjects/.ssh
chmod 0755 /home/username/GitHubProjects/.ssh

#General Environment ##memcache

sudo apt-get install memcached
sudo apt-get install php5-memcache

##cURL

sudo apt-get install curl
sudo apt-get install php5-curl

##Composer

curl -sS https://getcomposer.org/installer | php
sudo mv composer.phar /usr/local/bin/composer

#Zend Framework ##Zend Framework 1.12 *download the latest release of Zend Framework (http://framework.zend.com/downloads/)

tar -xzvf ZendFramework-1.12.3.tar.gz
sudo mkdir /usr/local/lamp
mv ZendFramework-1.12.3 /usr/local/lamp
chmod 0755 ZendFramework-1.12.3
chmod -R 0755 ZendFramework-1.12.3/*
ln -s /usr/local/ZendFramework-1.12.3/bin/zf.sh /usr/bin/zf
zf show version

*edit /etc/php5/apache2/php.ini

include_path = ".:/usr/share/php:/usr/local/ZendFramework-1.12.3/library"

##Zend Framework 2

sudo git clone https://github.com/zendframework/ZendSkeletonApplication /usr/local/lamp

or for use with netbeans just download .zip and move to /usr/local/lamp ##Create virtual host *add to /etc/vhosts

127.0.0.1 example.localhost

*create /etc/apache2/sites-available/example.localhost.conf

<VirtualHost *:80>
	ServerName example.localhost
	DocumentRoot /home/username/localhost/example.localhost/public/

	<Directory /home/username/localhost/example.localhost/public/ >
		DirectoryIndex index.php
		AllowOverride All
		Order allow,deny
		Allow from all
		Require all granted
	</Directory>

	ErrorLog ${APACHE_LOG_DIR}/error.log
	CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

...and

a2ensite example.localhost
/etc/init.d/apache2 restart

#IDE ##Oracle JDK 7 *recommended download the latest Oracle JDK (http://www.oracle.com/technetwork/java/javase/downloads/index.html)

tar -xvf jdk-7u45-linux-x64.tar.gz
sudo mkdir -p /usr/lib/jvm
mv jdk1.7.0 /usr/lib/jvm/
update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jdk1.7.0/bin/java" 1
update-alternatives --install "/usr/bin/javac" "javac" "/usr/lib/jvm/jdk1.7.0/bin/javac" 1
update-alternatives --install "/usr/bin/javaws" "javaws" "/usr/lib/jvm/jdk1.7.0/bin/javaws" 1
chmod a+x /usr/bin/java 
chmod a+x /usr/bin/javac 
chmod a+x /usr/bin/javaws
chown -R username:username /usr/lib/jvm/jdk1.7.0
update-alternatives --config java
java -version
update-alternatives --config javac
javac -version
update-alternatives --config javaws
javaws -version
ln -s /usr/lib/jvm/jdk1.7.0/jre/lib/amd64/libnpjp2.so /usr/lib/mozilla/plugins/

*edit /etc/apparmor.d/abstractions/ubuntu-browsers.d/java

#  /usr/lib/jvm/java-*-sun-1.*/jre/bin/java{,_vm} cx -> browser_java,
#  /usr/lib/jvm/java-*-sun-1.*/jre/lib/*/libnp*.so cx -> browser_java,
/usr/lib/jvm/jdk*/jre/bin/java{,_vm} cx -> browser_java,
/usr/lib/jvm/jdk*/jre/lib/*/libnp*.so cx -> browser_java,
/etc/init.d/apparmor restart

check java: http://java.com/en/download/installed.jsp

##NetBeans 7.4 *Download the latest version of NetBeans for PHP (https://netbeans.org/downloads/)

chmod +x netbeans.sh
./netbeans.sh

##Sublime Text 2 *Download the latest version of Sublime Text 2 (http://www.sublimetext.com/2)

tar xf Sublime\ Text\ 2.0.2\ x64.tar.bz2
sudo mv Sublime\ Text\ 2 /opt/
ln -s /opt/Sublime\ Text\ 2/sublime_text /usr/bin/sublime

*create /usr/share/applications/sublime.desktop

[Desktop Entry]
Version=1.0
Name=Sublime Text 2
GenericName=Text Editor
Exec=sublime
Terminal=false
Icon=/opt/Sublime Text 2/Icon/48x48/sublime_text.png
Type=Application
Categories=TextEditor;IDE;Development
X-Ayatana-Desktop-Shortcuts=NewWindow
[NewWindow Shortcut Group]
Name=New Window
Exec=sublime -n
TargetEnvironment=Unity

*edit /usr/share/applications/defaults.list and replace gedit.desktop with sublime.desktop

In case of problems with the display icon in the Dash

*edit /home/username/.local/share/applications/sublime-desktop

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment