Sunteți pe pagina 1din 29

How to install LAMP in Ubuntu 11.10 L.A.M.P. is an acronym for solution stack of free and open source software.

In order to create a viable general purpose web server, this term has been coined from the first letters of Linux (Operating System), Apache HTTP server, MySQL (database software) and Perl/Python/PHP. Generally P is taken to be as PHP but it may also refer to Perl or Python. PHP, Perl and Python are web scripting software. Each package can be configured and installed separately. Here we will see how to install them at one shot. In earlier version of Ubuntu we used to have tasksel and sudo tasksel to bring various options including lamp-server. Simply selecting lamp-server use to do the work. But we dont have tasksel in latest Ubuntu. No worries, we still can install the lamp stack in one shot. Open your terminal. Either press ctrl+alt+T or from dash type terminal and press enter. sudo apt-get install php5 mysql-server apache2 The above command will install latest version of PHP which is version 5 and mysql-server with apache http server 2. You will be prompted in terminal as shown in figure. Give a password for your MySQL root user (you can create more users too).

Now to check if its working or not just open your favorite browser and type localhost in the address bar. You should see something like this(note: this comes from the file index.html located in /var/www/ folder of your system.)

Now to check if php is working or if not, let us create a small php file Open your terminal and type- sudo vi /var/www/info.php 1

or you can open the same from gedit or any other editor as sudo gedit /var/www/info.php and write: <?php phpinfo(); ?> save the file and exit. Restart the apache2 service by typing the command in terminal sudo service apache2 restart

open your browser and type in address bar the following. localhost/info.php and you should see something like this:

Let us also install phpmyadmin . phpmyadmin helps to take control over our database. It can be done graphically from the browser or from the command line. to install sudo apt-get install phpmyadmin You will be prompted to screen like this- press space to select apache2 server and enter.

configure phpmyadmin with dbconfig-common. Press yes to configure. give your passwords.

When you are done type localhost/phpmyadmin in your address bar of browser, you should see something like thisgive user as root and password which you had given before. you will be taken to phpmyadmin page. on this page you can create databases, users and many more.

PROBLEMI Carl Draper I do sudo apt-get install tasksel sudo tasksel 3

Then select 'LAMP Server' using Tab and Enter :)


Like Reply 2 months ago 6 Likes

Chandan P. Gupta Thats neat and simple :) will update the post with this alternative style too . Thanks Carl

Like Reply 2 months ago in reply to Carl Draper

Innox2010 when am trying to type localhost/phpmyadmin am getting this message "Not Found The requested URL /phpmyadmin was not found on this server. Apache/2.2.17 (Ubuntu) Server at localhost Port 80" what can i do? have installed phpmyadmin.

Like Reply 2 weeks ago 1 Like

Rick Kalin I got the phpMyAdmin page but when I enter my password I get error '1045 can not log in to MySQL server'. How can I correct the passwors?

Like Reply 1 month ago 4

1 Like

Some1 probably you are not using right combination of username and password.. did you use "root" as username ? may be you can try remembering the right username and password or installing it once again (just the phpMyAdmin part)

Like Reply 1 month ago in reply to Rick Kalin

Rick Kalin The problem was with the password to MySQL. I was able to reset it using mysqld as shown at: http://ubuntu.flowconsult.at/e...

Like Reply 1 month ago in reply to Some1

Sandesh Yadav glad you were able to solve the problem :)


Like Reply 1 month ago in reply to Rick Kalin

Khasyapnaveendvg i am getting like this!!!!!!!!!!!!!! root@ubuntu:~# sudo service apache2 restart * Restarting web server apache2

... waiting 5

[ OK ] root@ubuntu:~#

Like Reply 2 months ago 1 Like

Chandan P. Gupta Thats perfectly fine buddy :) go ahead with next steps!

Like Reply 2 months ago in reply to Khasyapnaveendvg

Freddy Z Muy buen aporte. Gracias.

LAMP [Linux,Apache,Mysql,PHP] is the most winning combination in today s growning internet to develop dynamic PHP applications. The linux part is replaced by any linux distro like Ubuntu 11.10, Fedora 15, Opensuse 12.1, Debian etc Linux is the most fast and safest platform to develop PHP applications for todays web. How to install an Apache2 webserver on an Ubuntu 11.10 with Mysql and PHP is the most popular question. The answer is very simple. With some command line commands or a search in Latest Ubuntu Software center everyone can install the LAMP stack in ubuntu 11.10.

How To Install LAMP (Linux, Apache, MySQL, PHP) On Ubuntu 11.10


All the commands will be executed in the terminal. You can open a terminal using Ctrl+Alt+T shortcut.

Install Mysql 5 on Ubuntu 11.10


The first step is to install Mysql Server in Ubuntu 11.10. Just paste the command in the terminal and press enter:
sudo apt-get install mysql-server mysql-client

This will install the mysql server and mysql client on your ubuntu 11.10. After that it will as the password for the root user of mysql. You can set a password for that. By using this password you can enter into a mysql command mode.

Install Apache 2 Server on Ubuntu 11.10


The next step is install Apache server in ubuntu 11.10. The apache server is used to execute PHP files in the server. By default the server will run on http://localhost and port 80. You can change the server names and ports in apache configuration file.
sudo apt-get install apache2

After installing the apache server Just open firefox and type http://localhost. You will get a message. IT Works! This is the default web page for the server. The web server software is running but no content has been added. yet This is the default apache welcome page. You can edit this file in /var/www/index.html file. The configuration file for apache server is at /etc/apache2/apache2.conf. Additional configurations are stored in subdirectories of the /etc/apache2 directory such as /etc/apache2/modsenabled (for Apache modules), /etc/apache2/sites-enabled (for virtual hosts), and /etc/apache2/conf.d.

Install PHP 5 on Ubuntu 11.10


The next step is to install php5 on ubuntu 11.10 and extensions for php5. We can install PHP5 and the Apache PHP5 module by using the following commands.
sudo apt-get install php5 libapache2-mod-php5

We must restart Apache afterwards: /etc/init.d/apache2 restart

Get the PHP information in Ubuntu 11.10


Get the detailed information of PHP 5 from apache server. For that just create a file info.php on /var/www
sudo gedit /var/www/info.php

put the following code


<?php phpinfo(); ?>

Just call the file in your web browser using the url : http://localhost/info.php. You will get the complete information of your current php installation.

Getting MySQL Support In PHP5 on Ubuntu 11.1o


To get MySQL connectivity in PHP, we want to install the php5-mysql package. For that use the following command:
sudo apt-get install php5-mysql

Install PHP Modules on Ubuntu 11.10


Its a good idea to install some other PHP5 modules as well as you might need them for your applications. You can search for available PHP5 modules like this:
sudo apt-cache search php5

Install the PHP modules in ubuntu 11.10 by using the following command:
sudo apt-get install php5-curl php5-gd php5-idn php-pear php5-imagick php5-imap php5-mcrypt php5-memcache php5-ming php5-ps php5-pspell php5-recode php5-snmp php5-sqlite php5-tidy php5xmlrpc php5-xsl

These are the php modules to use gd library, curl, pear modules, image magic, mcrypt extension, memmory cache, tidy, xmlrpc, sqllite database etc Now restart Apache2 Server
sudo /etc/init.d/apache2 restart

Now refresh http://localhost/info.php in your firefox browser and scroll down to the modules section again. You should now find lots of new modules there, including the MySQL module:

Install phpMyAdmin in Ubuntu 11.10


phpMyAdmin is a great programme to manage mysql database from your web browser. The latest version includes very nice interface and great utilities like inplace edit etc.. By using phpMyAdmin you can create database, edit tables, insert data, export mysql database etc.. To install PHPMyAdmin use the command:
sudo apt-get install phpmyadmin

You will see the following questions after installation: Web server to reconfigure automatically: < apache2 Configure database for phpmyadmin with dbconfig-common? < No Afterwards, you can access phpMyAdmin under http://localhost/phpmyadmin/

Chive
Chive is also another great programme to manage mysql database from a web browser. This is project is developed using YII PHP frame work. You can download chive from their website. To install chive on ubuntu 11.10 just extract the zip file and copy the directory chive to /var/www . and then you can access chive mysql manager from web browser http://localhost/chive You can also use libreoffice base to access and edit mysql database. There is a mysql query builder and entity relation manger in libreoffice base.

Install PHP IDE Geany in Ubuntu 11.10


For developing PHP application you need a good IDE. Geany is a light weight fast ide developed using GTK library. You can install geany by using the command:
sudo apt-get install geany

There are other IDEs like PHP Eclipse, Komodo Edit, Netbeans, gPhpedit, bluefish etc for editing and developing php applications. Also there are lot of php frameworks available for developing great applications in php like Codeigniter, Cake PHP, Fuel PHP, Kohana, Yii, Zend Framework, Symphony etc You can try one.

Apache: http://httpd.apache.org/ PHP: http://www.php.net/ MySQL: http://www.mysql.com/ Ubuntu: http://www.ubuntu.com/ phpMyAdmin: http://www.phpmyadmin.net/ 9

Chive:http://www.chive-project.com/

php apache mysql phpmyadmin localhost is the development platform for php applications in ubuntu 11.10 Related articles php apache mysql phpmyadmin localhost (boomer.net16.net) Apache + PHP + MySQL on Ubuntu 11.04 (codingexplorer.wordpress.com) Setting up Ubuntu with LAMP plus others LinodeWiki (linode.com) Installing Cherokee With PHP5 And MySQL Support On Ubuntu 11.04 (sascho.wordpress.com) Installing Nginx With PHP5 (And PHP-FPM) And MySQL Support On Ubuntu 11.04 (sascho.wordpress.com) Update php on Joomla (edugeek.net)

10

Installing Subversion And Configuring Access Through Different Protocols On Ubuntu 11.10
Subversion (svn) is an open-source version control system (VCS), used in the development of many software projects. This tutorial shows how to install Subversion on Ubuntu 11.10 and how to configure it to allow access to a repository through different protocols: file://, http://, https://, svn://, and svn+ssh://. I do not issue any guarantee that this will work for you!

1 Preliminary Note
This tutorial concentrates on Subversion installation and configuration, not on its usage. You can find a list of usefull svn commands here: http://wiki.greenstone.org/wiki/index.php/Useful_SVN_Commands. The complete svn documentation is here: http://svnbook.red-bean.com/en/1.5/index.html The Ubuntu 11.10 system that I use here has the IP address 192.168.0.100 which I will use in the various svn commands throughout this tutorial. Make sure you replace it with your own server's IP/hostname.

2 Installing Subversion
Subversion can be installed as follows: apt-get install subversion Next we create a directory that will hold our repository/repositories - I use /var/lib/svn, but you can use another directory, if you like. mkdir -p /var/lib/svn I want to create a repository for my software project called myproject inside the /var/lib/svn directory - this can be done as follows: svnadmin create /var/lib/svn/myproject Of course, the repository is empty until we import our project into it. There are several ways or protocols that can be used to access svn:

file:// - Through this protocol you get direct repository access. Works only on the same system (local disk), not over the network. Works out of the box. http:// - It is possible to use WebDAV on a Subversion-aware Apache2 server to access a repository. Works over the network (port 80). https:// - Same as http://, but over a secure SSL connection (port 443). svn:// - Access to a repository is done through an svnserve server. Works over the network (port 3690). svn+ssh:// - Same as svn://, but through an SSH tunnel (port 22).

11

3 Using The file:// Protocol


The file:// protocol works out of the box (it doesn't require any server process), but only locally, not over the network. We can use it to import our software project (I have stored it in /home/falko/myproject) into our /var/lib/svn/myproject repository: svn import /home/falko/myproject file://localhost/var/lib/svn/myproject Checkouts can be done as follows: svn co file://localhost/var/lib/svn/myproject /home/falko/somedir

4 Using The http:// Protocol


For the http:// protocol, we need to configure WebDAV on an Apache2 server. Therefore we install Apache2 and the Apache2 SVN module now: apt-get install apache2 libapache2-svn Now we configure the Apache2 SVN module by editing the file /etc/apache2/mods-available/dav_svn.conf: vi /etc/apache2/mods-available/dav_svn.conf There's a configuration already in the file, but it is commented out. You can leave it commented out, but at the end of the file, please add the following lines:
[...] <Location /svn> DAV svn SVNParentPath /var/lib/svn AuthType Basic AuthName "Subversion Repository" AuthUserFile /etc/apache2/dav_svn.passwd <LimitExcept GET PROPFIND OPTIONS REPORT> Require valid-user </LimitExcept> </Location>

Restart Apache: /etc/init.d/apache2 restart Because we will read and write to our repositories as the Apache user (www-data) and group (www-data) from now on, we must change the owner and group of /var/lib/svn and its subdiretories to the Apache user and group now: chown -R www-data:www-data /var/lib/svn

12

Please note: If you decide to use http:// or https:// to access SVN, do not use any of the other protocols anymore to write to SVN because the ownerships of the changed files will not match the Apache user/group if you do not use http:// or https://! Now we must create the password file /etc/apache2/dav_svn.passwd that contains all users that will have access to SVN (I will use the users falko and till here). htpasswd -c /etc/apache2/dav_svn.passwd falko Please note: Use the -c switch only if you create the /etc/apache2/dav_svn.passwd file for the first time. If you want to add another user, please leave it out (otherwise the file will be created from scratch again which means you lose all users that are already in the file): htpasswd /etc/apache2/dav_svn.passwd till You can now do a checkout as follows using the http:// protocol (please make sure you use the correct username): svn co --username falko http://192.168.0.100/svn/myproject /home/falko/somedir

5 Using The https:// Protocol


If you want to use https://, please follow chapter 4, and then do this to enable the SSL Apache module and the default SSL web site: a2enmod ssl a2ensite default-ssl /etc/init.d/apache2 restart (Please note that the default Apache SSL web site uses a self-signed certificate. You might want to replace it with a certificate from a trusted CA. You might want to check out this tutorial for more details: How To Set Up An SSL Vhost Under Apache2 On Ubuntu 9.10/Debian Lenny.) Now you can access SVN through https:// and also http://. If you want https:// only, you can disable http:// as follows: Open /etc/apache2/mods-available/dav_svn.conf and comment out/remove the section that you have added in chapter 4: vi /etc/apache2/mods-available/dav_svn.conf
[...] # <Location /svn> # DAV svn # SVNParentPath /var/lib/svn # AuthType Basic # AuthName "Subversion Repository" # AuthUserFile /etc/apache2/dav_svn.passwd # <LimitExcept GET PROPFIND OPTIONS REPORT> # Require valid-user # </LimitExcept> # </Location>

13

Then open the vhost configuration file /etc/apache2/sites-available/default-ssl of the default SSL vhost and add the same section between <VirtualHost> and </VirtualHost>: vi /etc/apache2/sites-available/default-ssl
[...] <Location /svn> DAV svn SVNParentPath /var/lib/svn AuthType Basic AuthName "Subversion Repository" AuthUserFile /etc/apache2/dav_svn.passwd <LimitExcept GET PROPFIND OPTIONS REPORT> Require valid-user </LimitExcept> </Location> [...]

Then restart Apache: /etc/init.d/apache2 restart You can do a checkout as follows using the https:// protocol: svn co --username falko https://192.168.0.100/svn/myproject /home/falko/somedir Please note: If you decide to use http:// or https:// to access SVN, do not use any of the other protocols anymore to write to SVN because the ownerships of the changed files will not match the Apache user/group if you do not use http:// or https://!

6 Using The svn:// Protocol


We can use the svn:// protocol by starting the svnserve daemon. Before we do this, let's configure password protection for our repository. There's a conf/svnserve.conf file in each repository, so for /var/lib/svn/myproject it's /var/lib/svn/myproject/conf/svnserve.conf. open that file... vi /var/lib/svn/myproject/conf/svnserve.conf ... and uncomment the password-db = passwd line:
[...] [general] ### These options control access to the repository for unauthenticated ### and authenticated users. Valid values are "write", "read", ### and "none". The sample settings below are the defaults. # anon-access = read # auth-access = write ### The password-db option controls the location of the password ### database file. Unless you specify a path starting with a /, ### the file's location is relative to the directory containing ### this configuration file. ### If SASL is enabled (see below), this file will NOT be used.

14

### Uncomment the line below to use the default password file. password-db = passwd ### The authz-db option controls the location of the authorization ### rules for path-based access control. Unless you specify a path ### starting with a /, the file's location is relative to the the ### directory containing this file. If you don't specify an ### authz-db, no path-based access control is done. ### Uncomment the line below to use the default authorization file. # authz-db = authz ### This option specifies the authentication realm of the repository. ### If two repositories have the same authentication realm, they should ### have the same password database, and vice versa. The default realm ### is repository's uuid. # realm = My First Repository [...]

passwd refers to the passwd file in the same directory, i.e., /var/lib/svn/myproject/conf/passwd. Open that file and add your SVN users and passwords (passwords are in clear text): vi /var/lib/svn/myproject/conf/passwd
### ### ### ### This file is an example password file for svnserve. Its format is similar to that of svnserve.conf. As shown in the example below it contains one section labelled [users]. The name and password for each user follow, one account per line.

[users] falko = falkospassword till = tillspassword

We can now start the svnserve daemon: svnserve -d -r /var/lib/svn/ (The -d switch makes it run as a daemon in the background.) Run netstat -tap | grep svn and you should see that snvserve is listening on port 3690 (:svn): root@server1:~# netstat -tap | grep svn tcp 0 0 *:svn *:* root@server1:~# LISTEN 2950/svnserve

Now we can use the svn:// protocol. For example, a checkout can be done as follows: svn co --username falko svn://192.168.0.100/myproject /home/falko/somedir

15

7 Using The svn+ssh:// Protocol


To tunnel the svn:// protocol through SSH, just follow chapter 6 and make sure you have an SSH damon running on your Ubuntu system (if you have not, you can install it by running apt-get install openssh-server ssh ) That's it! All you have to do now is to use svn+ssh:// instead of svn://, for example, a checkout can be done as follows: svn co --username falko svn+ssh://192.168.0.100/var/lib/svn/myproject /home/falko/somedir

8 Links

Subversion: http://subversion.apache.org/ Ubuntu: http://www.ubuntu.com/

Useful SVN Commands

Contents
[hide]

1 Basic SVN commands o 1.1 Checking out projects o 1.2 svn update and revert o 1.3 svn diff o 1.4 Committing files o 1.5 Adding a new file to the repository o 1.6 Deleting a file from the repository o 1.7 Helpful svn commands 2 Conflicts and resolving them o 2.1 To resolve conflicts in a file marked with a C 3 Special SVN operations o 3.1 svn log and annotate o 3.2 Creating a new project in the svn repository o 3.3 Copying an older revision of a file or folder back into the current svn revision o 3.4 Checking out an older revision from SVN o 3.5 Changing an svn property o 3.6 SVN Externals
o

3.7 Getting the Revision Number of your Subversion Working Copy

Basic SVN commands

Checking out projects


16

You need to know the urls of the components you want to checkout. Then you would do either of the following:
svn checkout url svn co url

The above will check it all out into a default folder name. For instance:
svn checkout http://svn.greenstone.org/main/trunk/greenstone3

will check out Greenstone 3 into a folder called greenstone3 in the current directory. You can alternatively provide an optional folder name at the end of the command, to check the contents out into:
svn checkout http://svn.greenstone.org/main/trunk/greenstone3 gs3-svn

This will check out Greenstone 3 into a folder called gs3-svn.

svn update and revert


An svn update merges the repository's changes with the local changed code, or shows places where conflicts have arisen (conflicts are shown with a C next to the files you tried to update). If someone else had committed changes to the repository and if these did not conflict with the changes in your own version, the svn update would show up a "G", not a "C". To deal with conflicts (C), see a later section.

To update the local file(s) with just the changes made in the repository, do an "svn update": an "svn revert"--you would do this if you want to go back to the version of the file in the repository (you will lose all changes you had made since the last commit):

> svn update <filename1> <filename2> ... <filenameN> To overwrite local file(s) with the one in the repository, do

> svn revert <filename1> ... <filenameN>

You can update an entire directory (and subdirectories) by moving into that directory and typing:
> svn update

svn diff
Note that svn diff does not connect to the repository! It compares your file against the file you had downloaded, not the file as it exists at the moment in the svn repository. To find out what changes you've made to a greenstone source file:
> cd <folder containing source file> > svn diff <filename> e.g. > svn diff util.pm

Committing files
17

Perform an svn diff it to look over the changes made since you last updated the file. Then svn update the file, perform the svn diff on the updated file, then svn commit it with a message:
> svn diff <filename>

Will show you the changes you've made since you last did an svn update on the file.
> svn update <filename>

It will merge changes made to the file in the repository with the changes you have on your machine. Your own changes take precedence and these are preserved. However, conflicts may arise if any of the lines that have been modified on your machine have been changed in the repository since you last checked it out/svn-updated it.
> svn diff <filename>

This diff now shows up the differences between your current file and what's there now in the repository. Check that only the new code you have added is the sum total of the differences.
> svn commit - m "message" <filename>

Where the message string is one that explains what changes have been made, why you are committing the file or what purpose a new file serves. To perform these svn operations on more more than 1 file in one go, separate them by spaces:
> > > > svn svn svn svn diff <filename> <filename2> <filenameN> update <filename> <filename2> <filenameN> diff <filename> <filename2> <filenameN> commit - m "message" <filename> <filename2> <filenameN>

Adding a new file to the repository


How to add a file (not for creating new folders in the svn repository):
svn add <filename> svn commit -m "This new file will do something useful" <filename>

You can add more than one file at a time:


svn add <filename1> <filename2> <filenameN> svn commit -m "These new files work together to add some extra functionality" <filename1> <filename2> <filenameN>

Deleting a file from the repository


To remove a file from the repository, you need to give it the url of the file in the repository:
svn remove -m "I deleted this file for a reason" http://svn.greenstone.org/....../thefile.ext

Aliases for svn remove are "svn delete" and "svn rm". If more than one file needs to be removed, you need to perfom the svn remove operation for each file one after another. (You can't remove several files from the repository at the same time in one line.) 18

Helpful svn commands


> svn info > svn switch > svn status

If you do an "svn status" in a folder, it recursively lists all the Modified (M), Deleted (D) and Added (A) files. It will also show up files that are in conflict (C) and those about which svn does not know (?). To see what modifications were made to individual files marked with an M, you'd do an "svn diff":
> svn diff <filename> > svn help > svn help [item] eg. svn help status

The last gives instructions on how to use an svn command. For example:
> svn help commit

Will tell you that to commit changes, you do "svn commit [path] --message "<reasoning>"

Conflicts and resolving them


If, when doing an "svn status" of a folder you find any files marked with a C, then it means such files are in conflict with their corresponding versions in the svn repository. Doing an "svn update" may indicate files are in conflict as well. If you performed an "svn update" on some files (or on a folder) and one or more came up with the status C then you have a conflict. It means that changes to the same file on the same lines had been committed to the svn repository as what you have been working on. The update could not successfully merge the corresponding lines as it didn't know which lines to keep and which to overwrite: the lines are in conflict.

If you ever encounter a file in conflict and you view it in an editor, you will see that conflicted lines will be marked with ===== and >>>>. Both the changes you made and the conflicting changes in the repository will be embedded inside such special marks. (If you had done an "svn update" on files that turned out to conflict, the action would have created a couple of additional versions of the file: conflict-filename.mine and conflict-filename.<revisionnumber>. The first is your local version containing the changes you made. The second is the file as it is in the svn repository.)

To resolve conflicts in a file marked with a C


1. Open up the file that's in conflict in an editor. 2. Search for all occurrences of >>> or ===. Each occurrence marks a conflicted section and needs to be resolved. 3. Deal with marked sections as appropriate: decide which parts you want to keep, which should be removed or how to combine (the best of) both. 4. Once you've finished editing out the conflicts in the file, you have to set the file's status to resolved for it to be up to date (and updateable with svn):
svn resolved <filename>

If you now try svn update on the file, it should no longer be marked as being in conflict. 19

Special SVN operations

svn log and annotate

To find out the list of changes made to code in a file:

>svn annotate <filename>

The above will list the code changes with NUMBERS in front of each line. For example, svn annotate GathererProg.java | less To find the message added into the log for making a change
>svn log <filename>

That will give all the messages for all the code changes. For example, svn log GathererProg.java | less Or, if you know the specific line of change for which you want to understand the reasoning or view the log message:
>svn log -rNUMBER <filename>

For example: svn log -r10242 GathererProg.java If you want to find all the files in a particular commit and the log message for them:
svn -v log http://svn.greenstone.org -r18201

Example output:
-----------------------------------------------------------------------r18201 | ak19 | 2008-12-15 14:10:06 +1300 (Mon, 15 Dec 2008) | 1 line Changed paths: M /gsdl/trunk/perllib/unicode.pm When associated files are renamed with the URLencoded versions of their original filenames, the spaces are no longer URL encoded, as this conflicted with mp3, wmv and possibly other media file formats being opened in external or browser-embedded apps ------------------------------------------------------------------------

Creating a new project in the svn repository


You'd do this if you want to put your program, stored only on your machine at the moment, onto the svn repository. The program folder on your harddrive, called "my_program" for instance, may contain:

all the directories (e.g. src, lib, bin) and loose files (e.g. build.xml and *.bat, *.sh scripts).

20

If you want to put this project folder into the repository, inside http://svn.greenstone.org/other-projects/trunk/ then you would type the following in your x-term:
cd my_program svn import -m "my message" . http://svn.greenstone.org/other-projects/trunk/my_program

That will put your folder and its contents into the svn repository inside a similarly named folder. Now, we need to check out our own svn-managed copy: Move up out of the local my_program directory and make a back-up copy of original program folder, just in case:
3. cd .. 4. mv my_program my_program.bak

Finally, checkout the a copy of the program from the svn repository, that will be stored on your machine in my_program:
5. svn co http://svn.greenstone.org/other-projects/trunk/my_program

Your program folder is just as before, except that it's now managed with svn.

Copying an older revision of a file or folder back into the current svn revision
If you've accidentally deleted an svn repository folder, such as "my_program", and want to bring it back (the older version is, after all, stored in the svn repository):
svn copy -r <older version number> from-svn-url to-svn-url -m "message"

The revision version number you want to copy should be one where the folder (or file) you accidentally wiped out still exists. For example:
svn copy -r 15315 http://svn.greenstone.org/other-projects/trunk/my_program http://svn.greenstone.org/other-projects/trunk/my_program -m "Accidental delete restored"

The above copies the folder of revision version 15315 at http://svn.greenstone.org/other-projects/trunk/my_program into the same url at the current revision/head.

Checking out an older revision from SVN


a. In general, you would do:
/my/local/path/>svn update -r {2008-04-26}

If there were conflicts, delete everyting and checkout the older version:
/my/local/path/>svn co -r {2007-10-01} http://svn.greenstone.org/greenstone3/trunk .

Comparing versions: comparing current folder contents with contents of an older revision:
/my/local/path>svn diff -r {2008-04-26} .

21

b. Checking out an older revision of Greenstone 3 is a special situation. For this you would do:
ant <target> -Dbranch.revision=<number>

eg. ant prepare -Dbranch.revision=15190 This will do an ant prepare/ant install/ant command using the revision number specified. Usually, you'd want to do an "ant prepare" with the revision flag. (And thereafter compile your greenstone 3 up again with a normal "ant install".)

Changing an svn property


You may want to do this if a regular text file in the svn repository is marked as a binary file and therefore won't let you do an "svn diff" to compare the text contents. An example situation:
/my/full/path>svn diff file.ext

Output: Index: file.ext ___________________________________________________________________ Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream To view a listing of the svn properties on this file:
/my/full/path>svn proplist file.ext

Output: Properties on 'file.ext': svn:executable svn:mime-type To edit the svn properties of this file:
/my/full/path>svn propedit svn:mime-type file.ext

Output: svn: None of the environment variables SVN_EDITOR, VISUAL or EDITOR is set, and no 'editor-cmd' run-time configuration option was found
/my/full/path>export EDITOR=emacs

The above sets an editor to edit the svn properties with. In the example, it is the editor "emacs". On Windows you might set this to Notepad for instance. Now you can choose to edit these properties:
/my/full/path>svn propedit svn:mime-type file.ext

22

If you only opened it up in an editor to have a good look at the contents but didn't make (or save) any changes, then when you close the editor, the output will likely be: No changes to property 'svn:mime-type' on 'file.ext' The troublesome property is the mime-type, which we delete as follows:
/my/full/path>svn propdel svn:mime-type file.ext

Output: property 'svn:mime-type' deleted from 'file.ext'. Now, if we do an "svn diff" on the file (which we couldn't do before because the file's MIME type was set to binary):
/my/full/path>svn diff file.ext

the output will be: Property changes on: file.ext ___________________________________________________________________ Name: svn:mime-type - application/octet-stream
/my/full/path>svn commit -m "Property change from binary file into no longer having the mimetype property set (which didn't allow me to do a diff on the file)." file.ext

Sending file.ext Committed revision 16545.

SVN Externals
SVN externals grab folders and files located in another part of the SVN repository, which is handy if you want to avoid duplication. From version 1.6 of SVN, one can have svn externals pointing not only to folders but files. In order to set up or adjust the svn:externals property on a folder, so it knows upon checkout which other folders and files to grab from SVN as its subelements:

Use a terminal to set up an editor to adjust the svn externals property.

On Windows:
set EDITOR=Notepad

On Linux:
export EDITOR=emacs To start editing the

svn externals property at this folder (.) level, type the following in the terminal:

svn propedit svn:externals . Add in a line for each new file

or folder to be checked out: going from the Source, of where to checkout the file/folder from and which can be a relative path since it's pointing to the same SVN repository, to the Name that the file or folder should have once checked out into this location. E.g. if editing the GS3/gs2build's svn 23

externals property to tell it to grab setup scripts from greenstone 2, the entries to be made for this at the gs2build level in the editor would be:
../greenstone2/setup.bash setup.bash ../greenstone2/setup.bat setup.bat ../greenstone2/setup.csh setup.csh Finally, you need to commit the property

changes made at the current level (.) to the repository. Make sure that not else exists at this level or in subfolders that needs commitingelse it will be accidentally committed tooand then run a simple svn commit on the current folder:

svn commit -m "The svn externals property changed for this folder to grab files/folders from elsewhere" .

Getting the Revision Number of your Subversion Working Copy


svnversion .

24

WindowsDualBoot
Contents 1. Introduction 2. Back Up Your Data 3. Have a Windows recovery CD/DVD available 1. Getting Recovery Media 4. Install Ubuntu after Windows 1. Install Ubuntu 1. Automatic partition resizing (recommended) 2. Manual partitioning 5. Master Boot Record and Boot Manager 6. Installing Windows After Ubuntu 1. Recovering GRUB after reinstalling Windows 2. Master Boot Record backup and re-replacement 7. Issues with Windows XP and NTFS 1. Using QtParted from the System Rescue CD 2. Using GParted from UNetbootinPartedMagic 8. Also see 9. External Links

Introduction
This page describes how to set up your computer in order to dual boot Ubuntu and Windows.

Back Up Your Data


Although this may seem obvious, it is important to backup your files to an external backup medium before attempting a dual-boot install (or any other hard drive manipulation), in case your hard drive becomes corrupted during the process. External hard drives, USB flash drives, and multiple DVDs or CDs are all useful for this purpose.

Have a Windows recovery CD/DVD available


Some computer manufacturers that pre-install Windows provide a Windows recovery/re-installation CD or DVD with the computer. However, many companies no longer ship a physical disc but instead create a hidden partition on the hard drive in which the recovery-disk information is stored. A utility is then usually provided which allows the user to burn a recovery/re-installation CD or DVD from it. If you are buying a new computer and intent on dual-booting, make sure you have (or can make) a physical Windows recovery/re-installation CD or DVD. If neither a CD/DVD nor a recovery partition/burning utility is provided by your computer manufacturer, you may need to telephone your vendor and ask for a CD or DVD (to which you are normally entitled under the Windows EULA).

Getting Recovery Media


25

You may need to request a physical recovery/re-installation CD or DVD directly from your computer manufacturer. Here are some resources:

Dell Operating System (OS) Recovery CD Creation and Manual Operating System Reinstall Other related links and information for Dell owners Lenovo Product Recovery CD or DVD Getting recovery CDs from IBM for a Thinkpad Obtaining a Windows Recovery CD or DVD set for HP and Compaq PCs

Once you have created a physical backup disc from a restore-image partition on the hard-drive, the restore-image partition can either be removed or left in place. Ubuntu can be installed with it intact without problems. Alternatively, if you own a licensed copy of Windows Vista or Windows 7, you may download a system recovery CD that may be used to access a recovery console free of charge from NeoSmart Technologies. This CD can't be used to reinstall Windows in case things go majorly wrong, but it does contain the needed tools to set boot-related issues right.

Install Ubuntu after Windows


A Windows OS should be installed first, because its bootloader is very particular and the installer tends to overwrite the entire hard drive, wiping out any data stored on it. If Windows isn't already installed, install it first. If you are able to partition the drive prior to installing Windows, leave space for Ubuntu during the initial partitioning process. Then you won't have to resize your NTFS partition to make room for Ubuntu later, saving a bit of time. When a Windows installation already occupies the entire hard drive, its partition needs to be shrunk, creating free space for the Ubuntu partition. You can do this during the Ubuntu installation procedure, or you can see How to Resize Windows Partitions for other options. If you have resized a Windows 7 or Vista partition and cannot boot up windows, you can use the instructions from WindowsRecovery to fix it.

Install Ubuntu

Download an Ubuntu LiveCD image (.iso) from Ubuntu Downloads and burn it to a disc (see BurningIsoHowto). Insert the LiveCD into your CD-ROM drive and reboot your PC. If the computer does not boot from the CD (e.g. Windows starts again instead), reboot and check your BIOS settings by pressing F2, F12, Delete, or ESC. Select "boot from CD". Proceed with installation until you are asked this question: "How do you want to partition the disk?". If you have already partitioned the disk and left space for Ubuntu, install it to that and then follow the rest of the steps. Otherwise, choose one of the next two steps.

Automatic partition resizing (recommended)


Choose the first option, which should say "Install them side by side, choosing between them each startup". Specify the size of the new partition by dragging the slider at the bottom of the window. Click on "Forward". 26

Continue on to Finishing Ubuntu Installation

Manual partitioning

Choose "Manually edit partition table". Listed will be your current partitions. Select the partition you want to resize and press Enter. Select "Size:", press Enter. Select Yes, press Enter. Type in a new size in gigabytes for your partition, it's recommended you free up at least 10 GB of free space for your Ubuntu install. Press Enter when happy with your changes. It may take some time to apply the changes. Create a swap partition of at least your amount of RAM (if you don't know, 2000 MB is a good value). Create a partition for your Ubuntu installation. Select "Finish partitioning and write changes to disk".

Master Boot Record and Boot Manager


GRUB2 is the boot manager installed in Ubuntu by default. If you use the Alternate CD you can choose GRUB or Lilo instead. GRUB2, GRUB and Lilo are open source boot managers that install the main parts of the boot loaders inside Ubuntu. This means Ubuntu is independent and avoids any need for writing to other operating systems. To accomplish this, the only thing in your computer outside of Ubuntu that needs to be changed is a small code in the MBR (Master Boot Record) of the first hard disk. The MBR code is changed to point to the boot loader in Ubuntu. You will be presented with a list of operating systems and you can choose one to boot. If you do nothing the first option will boot after a ten second countdown. If you select Windows then GRUB or Lilo will chain-load Windows for you at the Windows boot sector, which is the first sector of the Windows partition. If you have a problem with changing the MBR code, you might prefer to just install the code for pointing to GRUB to the first sector of your Ubuntu partition instead. If you do that during the Ubuntu installation process, then Ubuntu won't boot until you configure some other boot manager to point to Ubuntu's boot sector. Windows Vista no longer utilizes boot.ini, ntdetect.com, and ntldr when booting. Instead, Vista stores all data for its new boot manager in a boot folder. Windows Vista ships with an command line utility called bcdedit.exe, which requires administrator credentials to use. You may want to read http://go.microsoft.com/fwlink/?LinkId=112156 about it. Using a command line utility always has its learning curve, so a more productive and better job can be done with a free utility called EasyBCD, developed and mastered during the times of Vista Beta. EasyBCD is very user friendly and many Vista users highly recommend it.

Installing Windows After Ubuntu


Normally when Windows is installed after Ubuntu the "Master Boot Record", MBR, will be overwritten. You can bootup off a LiveCD and repair the MBR. However, there are 2 different approaches:

Recovering GRUB after reinstalling Windows


Please refer to the Reinstalling GRUB2 guide.

Master Boot Record backup and re-replacement


Back-up the existing MBR, install Windows, replace your backup overwriting the Windows boot code: 27

1. Create an NTFS partition for windows (using fdisk, GPartEd or whatever tool you are familiar with) 2. Backup the MBR e.g. dd if=/dev/sda of=/mbr.bin bs=446 count=1 3. Install windows 4. Boot into a LiveCD 5. Mount your root partition in the LiveCD 6. Restore the MBR e.g. dd if=/media/sda/mbr.bin of=/dev/sda bs=446 count=1 7. Restart and Ubuntu will boot 8. Setup grub to boot windows

Issues with Windows XP and NTFS


The Ubuntu installer has included support for resizing NTFS partitions since Ubuntu 5.10 (Breezy Badger) was released way back in 2005. Very few problems have been reported relative to the huge number of times that the installer has been used. If you tried the above procedure and have had no luck, it might be that there is a pre-existing problem either in the file system, in the partition table or the hard disk. First you should try running CHKDSK before trying again to resize the partition, and if you are using the Alternate CD, defragging might help. It is recommended that you run CHKDSK once again after resizing your NTFS partition. Also, try the following alternative methods:

Using QtParted from the System Rescue CD


1. Boot into Windows and backup any valuable documents/photos etc onto removable media such as CDR/DVD-R. 2. Run the Windows disk check tool (Error-checking) on C: a couple of times (the results can be seen in the Administrative Tools > Event Viewer > Application under a "Winlogon" entry). 3. Run the Windows defragmentation tool on C: 4. Download the System Rescue CD ISO image (321 MB; has several very useful software tools). 5. Burn the ISO image to a CD. 6. Boot from the CD and hit Enter when you see the message "Boot:". 7. When you get a command prompt, enter:
run_qtparted

1. 2. 3. 4. 5.

Select your disk on the graphical screen (most likely /dev/hda). Select your NTFS partition to be resized (most likely /dev/hda1). Right click with the mouse and choose Resize. Set the new partition size. Commit your changes in the File -> Commit menu. If your keyboard and mouse stop responding during resizing then please just be patient.

6. Once your changes are saved, remove the System Rescue CD and insert your Ubuntu installation CD. 7. Reboot and install Ubuntu into the free space.

Using GParted from UNetbootin-PartedMagic


28

Another approach to resizing partitions, which does not require a CD, is to load PartedMagic from Windows via the UNetbootin PartedMagic Loader: 1. Download and install the Windows (.exe) file, then reboot. 2. Select the UNetbootin-partedmagic entry after rebooting, and wait as PartedMagic boots up. 3. 4. 5. 6. 7. 8. Start the partition manager by clicking the GParted icon on the the panel. Select your disk (probably /dev/sda) via the drop-down menu on the top-right corner of the interface. Right-click the NTFS partition to be resized (probably /dev/sda1), and select the "resize" option. Drag the slider to specify the new size the NTFS partition should be resized to, then press OK. Press the "Apply" button to resize the disk, then reboot once done. Upon the next Windows boot, click OK when prompted to remove UNetbootin-partedmagic to remove its boot menu entry.

Also see

MultiOSBoot - How to boot more than two operating systems from a single hard drive. Virtualization Category

External Links

Ubuntuguide -- Dual-booting Windows and Ubuntu -- concise and up-to-date Kubuntuguide -- Dual-booting Windows and Kubuntu -- concise and up-to-date Illustrated Dual Boot Site. Dual-Booting Ubuntu and Vista with EasyBCD Step-By-Step Screenshot Tutorial to set-up an Ubuntu + Vista dual-boot How-To: Dual-Boot Ubuntu 6.06 (Dapper) Linux Desktop Along Side Windows XP HowtoForge Guide: Partition Resizing using UNetbootin-PartedMagic

WindowsDualBoot (last edited 2012-01-17 22:45:29 by perspectoff)

29

S-ar putea să vă placă și