Showing posts with label ubuntu. Show all posts
Showing posts with label ubuntu. Show all posts

Thursday, March 13, 2014

Adding Secondary IP Address in Ubuntu (Linux in general)

In my works, sometimes I need to configure router/wireless router with my PC. But since my PC only has one ethernet port that configured with static IP address, I have to find a way to be able to configure the router/wireless router without unplug it. One way is by adding secondary (virtual) IP address on existing ethernet port.

You can do this by using temporary or permanent way.

Temporary way:
Pretend that your ethernet is eth0, and you know that DHCP block IP from the router/wireless router is 192.168.1.0/24, you can set static IP address in that range:
$ sudo ip addr add 192.168.1.11/24 dev eth0
And when you finished, you can just delete that temporary additional IP:
$ sudo ip addr del 192.168.1.11/24 dev eth0

Permanent way:
You can add permanently by adding config in /etc/network/interfaces file:
auto eth0:1
iface eth0:1 inet DHCP
Then you set eth0:1 to be up:
$ sudo ifup eth0:1
Check to make sure you've got the correct IP address assignment:
$ sudo ifconfig -a | grep eth0 
 

Monday, February 10, 2014

Use Python2.6 (instead of Python2.7) on Ubuntu Server 12.04

Ubuntu Server 12.04 comes with Python version 2.7 by default. Unfortunately, there are some apps development out there that still using Python 2.6. Here are some simple workaround to change the default Python2.7 to Python2.6:

1. Preliminary requirement:
$ sudo apt-get install python-software-properties
2. Adding PPA (because Python2.6 is not available anymore on Ubuntu Server 12.04, by default):
$ sudo add-apt-repository ppa:fkrull/deadsnakes
3. Update repository:
$ sudo apt-get update
4. Installing Python2.6:
$ sudo apt-get install python2.6 python2.6-dev
5. Change the symlink to Python2.6:
$ sudo ln -sfn /usr/bin/python2.6 /usr/bin/python
6. Check the version:
$ python --version

That's it, and you're done :)
 
 
 
 

Tuesday, October 8, 2013

Run X Applications Over Network Using SSH

Topology:
Linux-based PC: 192.168.1.1
Linux-based Laptop: 192.168.1.7

In PC, you edit /etc/ssh/sshd_config using any editor you like:
$ sudo vi /etc/ssh/sshd
Looking for this line, or you can add if it's not already there:
X11Forwarding     yes
Save that file and restart SSH service:
$ sudo /etc/init.d/ssh restart
Allow Laptop to run X applications:
$ xhost 192.168.1.7
Define default display:
$ export DISPLAY=192.168.1.1:0

Then from Laptop terminal, run the command to execute any X applications you like:
$ ssh -X [username]@192.168.1.1 firefox
$ ssh -X [username]@192.168.1.1 oowriter

That's it! :)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Wednesday, October 2, 2013

Change Group Owner For /var/www

Taking another note. Here's how to change group owner for /var/www directory in Ubuntu Server 12.04. By default that directory meant to be DocumentRoot for Apache 2 web server and own by root. This practice is useful if we want to share the access to several people in webmaster group.


sudo addgroup webmasters

sudo chgrp -R webmasters /var/www

sudo find /var/www -type d -exec chmod g=rwxs "{}" \;
sudo find /var/www -type f -exec chmod g=rws "{}" \;

sudo gpasswd --add user webmasters
sudo gpasswd --add colleague1 webmasters
sudo gpasswd --add colleague2 webmasters
# etc.

Tuesday, January 22, 2013

Accessing Nexus 4 USB Storage From Linux

The objectives is to be able to access USB storage on Nexus 4 from my Linux desktop. This way, I can easily copy and/or move files from/to Nexus 4.

1. Enable Developer options:
a. Open Settings
b. Tap 'About phone'
c. Tap on 'Build number' seven (yes, it's 7) times
d. You'll get the notification that Developer options is enabled

2. In settings, you'll find in System tab the Developer options, tap to open it, and then check the USB debugging option


3. Install necessary modules to Linux desktop:
$ sudo apt-get install mtp-tools mtpfs
4. Configure 51-android.rules:
$ sudo vi /etc/udev/rules.d/51-android.rules
5. Paste the following line into the file:
#LG - Nexus 4
SUBSYSTEM=="usb", ATTR{idVendor}=="1004", MODE="0666"
6. Make the file executable:
$ sudo chmod +x /etc/udev/rules.d/51-android.rules
7. Restart udev
$ sudo service udev restart
8. Create mount point and permissions
$ sudo mkdir /media/nexus4
$ chmod 755 /media/nexus4
9. Plug in Nexus 4 and make sure MTP is enabled


10. Mount with the following command:
$ sudo mtpfs -o allow_other /media/nexus4
11. And unmount it when you have completed your work:
$ sudo umount /media/nexus4

Practically you can do this with every other Android devices. Just plug your Android and use this command to get your idVendor and idProduct information:
$ mtp-detect | grep idVendor
$ mtp-detect | grep idProduct
Use the information on step 5 above, and you're good to go :)
 

Wednesday, November 7, 2012

Mutt: Viewing URL On Your Favorite Browser

On this past few weeks, I've been back using mutt. And this time, with much advanced configuration. One of its configuration is opening URL inside emails on your favorite browser. The requirement is simply using urlview that you can download from here (I'm using version 0.9), extract and compile it. Then add this config to your .muttrc file:
macro index \cu |urlview\n      # simulate the old browse-url function                                                                                                           
macro pager \cu |urlview\n
Also, you need to add ~/.urlview and put this line:
REGEXP (((http|https|ftp|gopher)|mailto)[.:][^ >"\t]*|www\.[-a-z0-9.]+)[^ .,;\t>">\):]
COMMAND <your-browser> %s

After all done, try to open one email in your mutt. Then in view mode, press ctrl-u and urlview will listing all available URL inside that email. You just have to choose one and press Enter, and your browser will automatically open and load that URL.
 

Wednesday, June 6, 2012

How to open .uif file in Ubuntu Linux

Here's how to open .uif file in Ubuntu Linux:
1. Install uif2iso package
$ sudo apt-get install uif2iso
2. Run command to convert .uif to .iso file
$ uif2iso file.uif file.iso
3. Mount .iso file
$ mkdir ~/iso_file
$ sudo mount file.iso ~/iso_file -t iso9660 -o loop
That's it! :)

Friday, May 18, 2012

Failed Installing Java on Ubuntu 12.04? Here Are The Workaround

If you happen to experience the same flaw to installing Java on Ubuntu 12.04, then you could do these steps:

sudo rm /var/lib/dpkg/info/oracle-java7-installer*
sudo apt-get purge oracle-java7-installer*
sudo rm /etc/apt/sources.list.d/*java*
sudo apt-get update
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java7-installer

Proven to be worked well :) Credit goes to the Ubuntu Forum thread here

Tuesday, April 17, 2012

Want to access Simplenote from Vim? Use Vimplenote!

If you're the person who always logging anything like I do, probably you should try Simplenote , "easy way to keep notes, lists, ideas, and more" -- that's what they say in their website :)

For me, the ubiquity to using their service in many platform is their advantage. As a vim user, fortunately there are already many plugins to support my need in using Simplenote service, and one of them is Vimplenote

One reason for choosing Vimplenote than another plugins is because it's the easiest one to configure. I also using Vundle, Vim package manager to install and manage my vim plugins.

Enough said, just follow my steps to do it:
1. I prefer clean install, so move your ~/.vim and archive it
$ mv ~/.vim ~/.vim-bk
2. Create new ~/.vim and ~/.vim/bundle (to contain your plugins)
$ mkdir -p ~/.vim/bundle
3. Setup Vundle
$ git clone https://github.com/gmarik/vundle.git ~/.vim/bundle/vundle
4. Configuring .vimrc
 set nocompatible               " be iMproved
 filetype off                   " required!

 set rtp+=~/.vim/bundle/vundle/
 call vundle#rc()

 " let Vundle manage Vundle
 " required! 
 Bundle 'gmarik/vundle'

 " My Bundles here:
 "
 " original repos on github
Bundle 'mattn/vimplenote'
Bundle 'mattn/webapi'
 " ...

 filetype plugin indent on     " required! 
 "
 " Brief help
 " :BundleList          - list configured bundles
 " :BundleInstall(!)    - install(update) bundles
 " :BundleSearch(!) foo - search(or refresh cache first) for foo
 " :BundleClean(!)      - confirm(or auto-approve) removal of unused bundles
 "
 " see :h vundle for more details or wiki for FAQ
 " NOTE: comments after Bundle command are not allowed.. 
5.  Get webapi-vim and vimplenote-vim
$ git clone git://github.com/mattn/webapi-vim.git ~/.vim/bundle/webapi
$ git clone git://github.com/mattn/vimplenote-vim.git ~/.vim/bundle/vimplenote
6. Running and installing bundle
$ vim
:BundleInstall
7. Using Vimplenote (do it inside vim)
:Vimplenote -l     " list of your Simplenote notes (you'll be prompted to fill in login credentials)
:Vimplenote -d    " delete your current note
:Vimplenote -n    " create new note
:Vimplenote -u    " update current note
:Vimplenote -t     " add a tag to a note
:Vimplenote -s    " search a note
And you're good to go :)

You can also see the README file in every plugin page to see additional info.

Thursday, October 27, 2011

Generate X.509 CER File For #webOS Using openssl

Recently I've got a problem with SSL certificate for outgoing mail server on my Palm Pre. Here's what the error look like:


I looked around in the internet to find a solutions, then I found this page (forgot about the link, but I'm certain that was Palm Support page) that says mail server's certificate should be in X.509 (CER) file format:


Already asked System Administrator to send me the file, but it takes too long. So initiatively I look another way to provide the certificate file myself, and I can do it using openssl command in Ubuntu Linux (You can use openssl in Windows as well). First, I create a script that generate the certificate I need from mail server, name the file any name you want (you can see in the script I used retrieve-cert.sh):
#!/bin/sh
#
# usage: retrieve-cert.sh remote.host.name [port]
#
REMHOST=$1
REMPORT=${2:-443}

echo |\
openssl s_client -connect ${REMHOST}:${REMPORT} 2>&1 |\
sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p'
Add execute (+x) on file properties, then run the files:
$ chmod + retrieve-cert.sh
$ ./retrieve-cert.sh mail.server.hostname 465 >> coid.cer
As you can see, I'm adding '>> mycert.cer' to save the results directly to mycert.cer file, at the command above. Sure I can add this to the script, but this way I can generate any file name I want :)

Then, you must convert that .cer file into X.509 format:
$ openssl x509 -in coid.cer -out coidx509.cer
And you're finish. You can send coidx509.cer file via email that already setup on your Pre, or you can transfer it via USB mode and open it using Internalz.

When you tap on that file, Certificates Manager window will open and ask what do you want to do with it:


Just tap on 'Trust Certificate'. If you want to see it later, open 'Device Info' on your launcher, then tap drop-down menu on top left, tap on 'Certificate Manager...'


That's it. I setup my mail account once again, and sure it can sent email without any error :)

Thursday, October 13, 2011

BingMaps go forth and back to Google Maps

If you haven't know yet, there's an update for Google Maps on your webOS smartphone (Pre, Pixi, Veer), not to another version, but to BingMaps, which is the Maps apps pre-installed in TouchPad.

Like the HP Palm Blog says, you just open App Catalog and download Maps apps from there in order to update your Google Maps.

I did that myself, and not too long after that I decided to get my old Google Maps back. So I open up webOS doctor file and look for Maps application. With the help from #webos-internals on freenode, I found it under /usr/palm/applications in com.palm.app.maps folder. So I re-package it using IPK Packager from Jason Robbitaile.

After deleting Maps apps, I installing this file using webOS Quick Install (wOSQI), again from Jason, and I've got my Google Maps back :)

Newest Firefox Version for Ubuntu 10.04

Default repository on Ubuntu 10.04 prevent us to have version of Firefox above 3.6.x, but with this simple workaround, you can get newest version (7.0.1) for Firefox and Thunderbird, also.

What you have to do is adding this line into /etc/apt/sources.list:
#Firefox-Stable
deb http://ppa.launchpad.net/mozillateam/firefox-stable/ubuntu hardy main
deb-src http://ppa.launchpad.net/mozillateam/firefox-stable/ubuntu hardy main
Do the regular:
$ sudo apt-get update
$ sudo apt-get install firefox
And it's done! :)

Fluxbox installation on Ubuntu Server

Here's what you need to have a decent Fluxbox windowmanager on Ubuntu Server. After all, you don't need a heavy windowmanager on your server :)
$ sudo apt-get install fluxbox fbpager fbdesk xserver-xorg xfs xfonts-terminus-oblique xfonts-100dpi xfonts-75dpi xfonts-scalable xinit
 And that's it! :)

update-notifier-common error on Ubuntu

After doing Ubuntu double upgrade (from 10.04 to 10.10, then continue with 10.10 to 11.04), I've got this error while logging in into the system:
exec: 3: /usr/lib/update-notifier/update-motd-cpu-checker: not found
run-parts: /etc/update-motd.d/20-cpu-checker exited with return code 2
run-parts: failed to stat component /etc/update-motd.d/50-landscape-sysinfo: No such file or directory
exec: 3: /usr/lib/update-notifier/update-motd-updates-available: not found
run-parts: /etc/update-motd.d/90-updates-available exited with return code 2
exec: 3: /usr/lib/update-notifier/update-motd-reboot-required: not found
run-parts: /etc/update-motd.d/98-reboot-required exited with return code 2
Apparently, some package were removed during the upgrade process. All I need to do was installed one packaged:
$ sudo apt-get install update-notifier-common
And everything's back to normal afterwards :)

Monday, October 10, 2011

How To Overcome GPG Errors on Ubuntu Linux (Lucid 10.04)

If you ever got the GPG errors while updating your Ubuntu sources, here's what you have to do to overcome it:

Example of the error might be like this:
W: GPG error: http://ppa.launchpad.net lucid Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY EF4186FE247510BE
And you just need to execute these two commands:
# gpg --keyserver hkp://subkeys.pgp.net --recv-keys KEY
# gpg --export --armor KEY | sudo apt-key add -
Just replace ke KEY with the one that exist on the error. According to the example, the command should be like this:
# gpg --keyserver hkp://subkeys.pgp.net --recv-keys EF4186FE247510BE
gpg: requesting key 247510BE from hkp server subkeys.pgp.net
gpg: key 247510BE: public key "Launchpad PPA for Ubuntu Mozilla Daily Build Team" imported
gpg: no ultimately trusted keys found
gpg: Total number processed: 1
gpg:               imported: 1  (RSA: 1)

# gpg --export --armor EF4186FE247510BE | sudo apt-key add -
OK
Then you can continue with:
# apt-get update
That's it. Why don't you try it yourself now :)

Tuesday, October 4, 2011

Install sun-java6-jre Package on Ubuntu 10.04

I need this package to be able run Go Aruna Desktop client on my Ubuntu 10.04. Here are what I did:
1. Add new sources
# sudo add-apt-repository "deb http://archive.canonical.com/ lucid partner"
2. Then do the usual update
# sudo apt-get update
# sudo apt-get dist-upgrade
3. Installing the package
# sudo apt-get install sun-java6-jre
4. Done

Friday, September 30, 2011

TTYtter Notification using LibNotify in Ubuntu Linux

Probably you already read my another blogpost about ttytter. This one is additional information on how to enabling popup notifications (like Growl in Mac OS) . According to my previous blogpost, you can run ttytter by executing this command:
# ./ttytter
And, if in any case, you missed it, then you just need to go to FloodGap website, scroll down a little bit, then under the "Download and change-log" section: right click and save file as 'ttytter' (without extension).



Open terminal, go to the directory where you keep the 'ttytter' file and I'm going to improve that a little bit by moving ttytter file to /usr/local/bin:
# sudo mv ttytter /usr/local/bin


Installing notification system
In order to be able to receive a popup notification, you must installing several package from Ubuntu repositories:
1. Installing git-core and libgtk2-perl-notify package
$ sudo apt-get install git-core libgtk2-notify-perl
2. Make sure you in your home directory by typing:
$ cd
3. Then do these steps:
$ git clone http://github.com/colindean/ttytter-libnotifyperl.git
$ sudo apt-get source libnotify-bin
$ sudo apt-get install gtk-doc-tools
$ sudo apt-get build-dep libnotify
4. Download this patch
5. And do these steps:
$ cd libnotify-0.4.5/ (or whatever version/ directory name you have there, according to version downloaded)
$ patch -p0 < ../notify-send-support_body_from_file.patch
$ ./autogen.sh
$ make
$ sudo make install
After all done, you need to go here to create your own .ttytterrc file and put it in your home directory. That's it. Credit goes to stormsdragon. Enjoy! :)

Monday, July 11, 2011

Installing Dropbox on Ubuntu Server 10.04

Just installed on my PC running Ubuntu Server 10.04, a little hard to find source to add to repository. But here it is, all you need to do is just follow these steps:

1. Make sure you have installed Nautilus
$ sudo apt-get install nautilus
2. Install public key to authenticate Dropbox's Ubuntu repository
$ sudo apt-key adv --keyserver pgp.mit.edu --recv-keys 5044912E
3. Add source to repository
$ sudo vim /etc/apt/sources.list
#Dropbox
deb http://linux.dropbox.com/ubuntu lucid main
4. Update repositories
$ sudo apt-get update
5. Install Dropbox integration for Nautilus
$ sudo apt-get install nautilus-dropbox
6. Starting Dropbox daemon
$ dropbox start -i


You have to restart all intances of Nautilus, then start Dropbox and fill in your account information. That's it! :)



Thursday, June 9, 2011

Setting Chromium-browser's Proxy on Ubuntu Server

Using Ubuntu Server 10.04 (Lucid Lynx), I install an X Server then use fluxbox as my Window Manager. For web browser, I tend to use Chrome browser from Google (chromium-browser package in Ubuntu). Here's what I do:

1. Install Chromium-browser
# apt-get install chromium-browser

Since I can't change proxy preferences in chromium-browser running on ubuntu server, so I have to do it on launch by creating shortcut file

2. Create the file
# vim chrome (of course you can choose any file name you want)

3. Input command to the file (choose one based on your proxy configuration)
# chromium-browser --proxy-pac-url=http://link.to/proxy.pac --enable-plugins
# chromium-browser --proxy-server="http://proxy.url:port/" --enable-plugins
# chromium-browser --proxy-server="socks://proxy.url:port/" --enable-plugins

3. Save the file and quit
4. Give execute permission to that file you've just created
# chmod +x chrome

5. You're done! :)

note:
- you can show another option to add another command on the file you created by executing this:
# man chromium-browser

- just found out in Debian, the command is 'google-chrome' instead of 'chromium-browser' :)

Monday, May 30, 2011

Ubuntu Dynamips and Dynagen

Here's how to install Dynamips and Dynagen Cisco Router emulator on Ubuntu:


1. Installation
# sudo apt-get install dynamips dynagen


2. IOS image
Get yourself a Cisco IOS image to use with the emulator. It is a good idea to uncompress the image for better loading
# unzip -p c7200-jk9s.mz.124-13b.bin> c7200-jk9s.mz.124-13b.image


3. Configure telnet client
You can configure your telnet client in /etc/dynagen.ini file, just uncomment this line:
telnet = xterm -T %d -e telnet %h %p > /dev/null 2>&1 &


4. Configuration file
You will need a configuration file for your router(s), you can see the example here: /usr/share/doc/dynagen/examples/sample_labs/simple1/simple1.net


The configuration will look like this:
[localhost]
     [[7200]]
     image = /opt/7200-images/c7200-jk9o3s-mz.124-7a.image
     npe = npe-400
     ram = 160
     [[ROUTER R1]]
     s1/0 = R2 s1/0
     # No need to specify an adapter here, it is taken care of
     # by the interface specification under Router R1


5. Starting Server and Management Console
To start the server
# dynamips -H 7200 &


And you can start to console using command:
# dynagen /usr/share/doc/dynagen/examples/sample_labs/simple1/simple1.net


After that you can refer to this link for further reference.