Ubuntu 12.04 Quick User Review

Using Ubuntu 12.04 and quite satisfactory so far! I’ll update this post regularly as I continue using it!

Pros (+)

  1. It’s cool! My Notebook was getting extremely hot and was getting turned off in Ubuntu 11.10. The notebook (Dell Inspiron 14z) is remaining cool most of the time. Even if when it get’s hot, it cools down after some time.
  2. The Network Manager is improved. In previous versions of Ubuntu, network manager could not re-establish a connection if my wireless router was turned off by power failure. But in 12.04, network manager can re-establish WiFi connection after it gets disconnected from wireless router.
  3. The look-&-feel is improved. Window movement, animations are catchy. It’s really looks cool!

Cons (-)

  1. Like previous versions, it happens to freeze – so far it happened once in the week. Everything in the screen just freezes and I have to restart using Power switch.
  2. Skype hangs some time when starting, and after that, it closes. And the whole OS acts weird. I can not find apps searching in the launcher, the problem only solves after I log-out & log-in again.

Send Commit Emails after users push in remote Git repository/server

Note: If you prefer to use terminal, you may need root access to use the following commands. If necessary, append “sudo” to all commands.

First, login to your remote server using ssh/ftp whatever. In your servers, say git repos are stored in /srv/gitosis/repositories directory (this is the default directory if you used gitosis).

Say, we’re interested in a repo called “myrepo.git” – it’d be available in /srv/gitosis/repositories/myrepo.git location.

Go to this folder. If you’re using terminal, you can type:

cd /srv/gitosis/repositories/myrepo.git

Some nice Description

Open file “description” and type whatever you want – text in this file will be sent in email’s subject as PROJECT NAME.

Mailing List

Open file “config” and add folowing text, configure to which addresses email will be sent as:

[hooks]        
mailinglist = email1@gmail.com, email2@gmail.com        
showrev = "git show -C %s; echo"        
emailprefix = "[My Git Repo] "

Save the file. If you’re using terminal, you can open the files for editing using nano <filaname> command. When done editing, press Ctrl + x for exit, then press y for saving, press enter to use original file name for saving the file.

Activate Hooks

Now go to “hooks” directory & rename the file post-receive.sample to post-receive:

cd hooks
mv post-receive.sample post-receive

Open the file (“post-receive”) for editing. Uncomment the last line by removing the beginning “#”, then save it.

Set Execute Permission on

Following 2 files should be made executable. I’m showing examples by terminal. If you’re using Filezilla/other file browser, make files “executable”, probably by right clicking on the files and clicking something like permission.

chmod 0755 /usr/share/doc/git-core/contrib/hooks/post-receive-email
chmod 0755 post-receive

That’s it! Now whenever someone pushes to the repo, emails will be sent according to the config file you’ve just edited.

References

http://stackoverflow.com/questions/552360/git-push-email-notification

http://book.git-scm.com/5_git_hooks.html

Note: If the file “/usr/share/doc/git-core/contrib/hooks/post-receive-email” is missing, you can use following file downloading.

http://git.kernel.org/?p=git/git.git;a=blob_plain;f=contrib/hooks/post-receive-email;h=60cbab65d3f8230be3041a13fac2fd9f9b3018d5;hb=HEAD

Create SVN Repository in Ubuntu & Access via HTTP

Requirements:

Assuming, you’ve Apache server installed already.

1. Install SVN

Open a terminal & type:

sudo apt-get install subversion

2. Create Repo

Let’s say, we want to create a repo in /var/svn/myrepo. Type in terminal:

cd /var
sudo mkdir svn
sudo svnadmin create /var/svn/myrepo

3. Users & Groups

Create a user & group named “svn”:

sudo adduser svn

Add user “www-data” to “svn” group:

sudo usermod -a -G svn www-data
sudo chown -R www-data:svn /var/svn/myrepo # Run this twice
sudo chmod -R g+rws /var/svn/myrepo # Run this twice

4.  Configure Apache2

Run in terminal:

sudo apt-get install libapache2-svn

You’ll find a file in /etc/apache2/sites-enabled folder. Let’s say, this file is “000-default” (in most cases) – edit this file by typing:

gksudo gedit /etc/apache2/sites-enabled/000-default

Add following lines in the beginning of the file:

    <Location /svn/myrepo>
      DAV svn
      SVNPath /var/svn/myrepo

      AuthType Basic
      AuthName "Subversion Repository"
      AuthUserFile /etc/apache2/passwords
      Require valid-user

    </Location>

Save the file, then restart apache:

sudo /etc/init.d/apache2 restart

5. Adding Users

Then Add the first user typing:

sudo htpasswd -cb /etc/apache2/passwords user1 password-for-user

# Add more users...

sudo htpasswd -b /etc/apache2/passwords user2 password-for-user

Finally, you’ll be able to access your repo at:

http://<ip-of-your-machine>/svn/myrepo

Instead of <ip-of-your-machine> you can also use your computer’s name.

References:

http://www.subversionary.org/howto/setting-up-a-subversion-server-on-ubuntu-gutsy-gibbon-server

https://help.ubuntu.com/community/Subversion

Automount, Execute or Own File system/disc partition/drive in Ubuntu

Let’s say, you have an NTFS drive which you want to mount automatically every time you boot your Ubuntu machine. In addition, you want to execute files from that drive, or own that filesystem. For all these, you need to modfiy a file located as /etc/fstab

1. Identify the disc partition

Type in terminal:

sudo fdisk -l

This command will output all the partitions. Look a the first column, labelled as “Device”. Let’s say, your desired partition is /dev/sda2

2. Create a directory to mount the partition

You need to create a directory where the filesystem will be available. Typically, these directories are created in /media location. Let’s say,  you want your filesystem to be available at /media/myNewDrive location. So, type in terminal:

sudo mkdir /media/myNewDrive

3. Edit /etc/fstab file

We’re almost done! Type in terminal:

gksudo gedit /etc/fstab

This will open the file for editing. Add a line at the bottom of the file like this:

/dev/sda2    /media/myNewDrive    ntfs-3g    auto,user,exec    0    0

Wondering what it means? Please visit this link, all of the fields (columns –  you can see there are 6 columns in the line above sperated by spaces) are nicely explained. You will need one line like this for each of the partitions you need to automatically mount/execute etc.

4. Save & Reboot…

Save the file & restart your machine to see effects.

To see various options available, study materials at following links.

References

https://help.ubuntu.com/community/AutomaticallyMountPartitions

http://www.tuxfiles.org/linuxhelp/fstab.html

A sample /etc/fstab file

Update Drupal Modules using FTP in localhost

When you’re going to update Drupal 7 modules using FTP, you need to have a FTP server running in your computer. In Ubuntu/Linux, we can have one named vsftpd (Very secured FTP Daemon) by running following command in the terminal:

Configuration:

Drupal: 7.0+

OS: Ubuntu/Linux

Step 1: Install VSFTPD

sudo apt-get install vsftpd

Step 2: Have an FTP account

Next, we need to add your Ubuntu user account to the FTP group. You can do it either by:

Open Users & Groups > Manage Groups. Double-click on FTP. Put tick-mark on your user-account, and click OK.

In the screenshot above, I’ve added my user account “giga” to the FTP group. So, I can use my username “giga” and my account’s password to run FTP.

3. Configure VSFTPD

Run in terminal:

gksudo gedit /etc/vsftpd.conf

Make sure you have following lines in the configuration file. Also check that they’re not preceeded by a “#”:

listen=YES
local_enable=YES
write_enable=YES
local_umask=022

Save and close the editor. Now we restart vsftpd by the following command:

sudo /etc/init.d/vsftpd restart

Step 4: Own your Drupal site

Run following command to own all of your Drupal scripts.

chown -R your-username /path-to-drupal

Finally…

Yes, we’re done. 🙂 Use your username (“giga” in this example) and system password to connect to FTP while upgrading modules.

 

 

Remove Device (Disc Volume) icons from Ubuntu Unity Sidebar/Lunchbar

1. Install dconf-editor. Open Ubuntu Software Center:

  • Press Windows/super key from your keyboard. Then search by typing Ubuntu Software Center, open it.
  • Type dconf-editor in the search bar & install it.

2. Open dconf-editor by typing following in a terminal:

dconf-editor

3. Go to desktop —> unity –> devices –> devices-option. The default is “OnlyMounted”. Set to “Never”.

That’s it. 🙂 Thanks to Bahar vai