1

Setting up Ubuntu for Web and Mobile Development

Posted July 14th, 2011 in News by Gevork

I made again fresh install of Ubuntu, because I have crashed DPKG manager, by deleting it’s folder :(

So I will setup again all the stuff needed to develop on php/mysql

and  Rhodes Mobile Framework

 

1) First update your system

 

sudo apt-get update

sudo apt-get upgrade

 

restart if needed

 

 

then in terminal enter

 

sudo apt-get install lamp-server^

 

you will get something like

 

After this operation, 82.1 MB of additional disk space will be used.
Do you want to continue [Y/n]?

Press Enter

 

Then violet screen of Mysql config will come , enter a desired password for root user and confirm by repeating.

 

now go to http://localhost

 

If you see

 

It works!

This is the default web page for this server.

The web server software is running but no content has been added, yet.

 

Then you are done with 1st part of sever setup for web-development…

 

I personally have to many times reinstall ubuntu from scratch. In that case my mysql folder which is in the root drive is deleted. For security reasons, in case I will fogert the backup before formatting drive, I put mysql data folder in user account, as /home drive I don’t format during installation.

 

please use this howto for that. It’s great and working

 

then we play with virtual hosts and add some new ones like this

 

sudo gedit

 

gedit will open in sudo mode to edit any root access files

 

open in it

 

/etc/hosts

and

/etc/apache2/sites-availble/default

 

lets say we need to create 1) test1.com  domain for development…

default file opened in our gedit we make Save As and in the same folder we save under name test1.com

we need a small changes

 

a) add somewhere line

 

ServerName:test1.com

 

and change everywhere /var/www  to any folder name, where your website sources should  be hosted. That is for me /home/geviline/Desktop/webserver/test1_com

 

 

 

b) in the /etc/hosts   add line

 

127.0.1.1 test1.com

 

or

127.0.0.1 test1.com

 

PHPMYADMIN INSTALL

 

sudo apt-get install phpmyadmin

sudo gedit  /etc/apache2/httpd.conf


Into the file write: Include /etc/phpmyadmin/apache.conf
Save the file.
service apache2 restart

depending on your default locahost value… usually you will see that number inside /etc/hosts file.

And finally if you want to use .htaccess file to ovverride some values, or mod_rewrite stuff please find

 

AllowOverride None

to

AllowOverride All

for your source folder

 

 

 

Example

 

ServerAdmin webmaster@localhost
ServerName  bookastudent.com
DocumentRoot /home/geviline/webserver/bookastudent

Options FollowSymLinks
AllowOverride All

Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all

ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/

AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all

ErrorLog ${APACHE_LOG_DIR}/error.log

# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn

CustomLog ${APACHE_LOG_DIR}/access.log combined

Alias /doc/ "/usr/share/doc/"

Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Allow from 127.0.0.0/255.0.0.0 ::1/128

 

Now save both files   Repeat this for all other domains you want to use for your local development   now we need to activate site for apache

sudo a2ensite test1.com

 

here test1.com is a file name under which you saved the virtualhost file . repeat for any new web-site you create.

now make

 

sudo  /etc/init.d/apache2 reload

ignore message

“apache2: Could not reliably determine the server’s fully qualified domain name, using 127.0.1.1 for ServerName”

now put in the folder where you have pointed test1.com a file index.php

and write in it any code lets say

phpinfo();

 

 


 

 

 

Note:

 

 

 

Now we will need to setup some domains which we will use as development domains

 

 

Go to software center and install

  1. Java
  2. Java JRE
  3. Netbeans or/and Eclipse

 

 

 

and open in browser

http://test1.com

you should see phpinfo page…..

Vualah!

Now we need 1 more thing to be happy

1) FTP Client

The best for me is krusader

Why? Because only in that I found possibility , that you can open a file, edit, push Save and it will directly save file on server. On total-commander you should save, close and then it will detetct change and save the file. that’s why we make

 

 

sudo apt-get install krusader

 

If you use some source control, then go on to have it also. In ubuntu there is Git, Mercurial and SVN…

Now Rhodes…

rhodes is a great framework for cross-platform mobile applications using ruby/html/css/jquery

 

that’s why we do such thing

sudo apt-get install openjdk-6-jdk;
sudo apt-get install ruby;
sudo apt-get install rails;
sudo apt-get install rubygems1.8;
sudo gem install rails -V;
sudo gem install templater -V;
sudo gem install rhodes -V;

you need to know where rhodes is located
it will be somewhere in /var/lib/gems/1.8/gems/rhodes-3.*.*

for me it was /var/lib/gems/1.8/gems/rhodes-3.0.2

 

now type this command….

export PATH=$PATH:"/var/lib/gems/1.8/gems/rhodes-3.0.2/bin"

download android sdk and ndk from here:

SDK: http://developer.android.com/sdk/index.html
NDK: http://developer.android.com/sdk/ndk/index.html

now extract both in your home folder and type (basically go to tools
folder)….
cd android-sdk-linux_86
cd tools
./android (execute the emulator see if there are any errors…..)

now type this command:

rhodes-setup

answer questions about location of JDK, Andorid SDK, NDK


 

$JDK path: /usr/lib/jvm/java-6-openjdk/

$Android SDK path: /home/ANDORID_SDK_FOLDER_WAY

$ Android NDK path: /home/NDK_FOLDER_WAY

 

left blank for Blackberry and other

rhodes is ready, make default app

rhogen app myApp

(here myApp is the name of folder in your home folder where the app source is located)

now type:

cd myApp

In Andorid Sdk you should beforehand open and start emulator of andorid, any version, preferable <=2.3 . And when it’s opened, then

rake run:android

Watch some fun stuff on youtube untill the app will be built and transfered to Andorid Emulator…

 

That’s All Folk….

 

 

 

One Response so far.

  1. nurbol says:

    interesnoe,spasibo avtoru!

Leave a Reply