Translation


by Transposh

Posts Tagged ‘Ubuntu’

Set Up Your Own Ubuntu Repository using apt-mirror

Sunday, February 6th, 2011

What is Ubuntu Repository?

It is the place where all software’s builds are stored for ubuntu. And when you make any install it downloads the package and install it.


Who should create a Repository?

If  you have a lots of ubuntu machines and you want to update and install a lot of packages in all the machines,else you have a slow internet connections then this is for you.


How can you create a Repository?

There are many ways how you can create a Repository.

  1. apt-proxy
  2. apt-cacher
  3. apt-mirror

Here I am going to show you how to create using apt-mirror. And if the machine is connected to internet,with web configuration it can also be used as a mirror in internet to download from.


Process of Creating The Repository

First of all you need a fast internet connection(this is required only once) with about 80 GB space to get all the downloaded packages.
I am setting up a repository for maverick-meerkat and have also included third party softwares.If you want you can add to the repositories with new source link and also remove some if you don’t want some.It almost is about 63.9 GB but i have added another 20 GB for fail safe options.

So here we go.

Step1: First install apt-mirror

1
sudo apt-get install apt-mirror

now you have the apt-mirror installed,Lets configure it

Step2:

1
 gksudo gedit /etc/apt/mirror.list

Here’s where you can enter the repositories that your local mirror will get all of it’s sources and debs from

Here’s what my mirror.list file looks like. Feel free to modify it to include or exclude what you will. Also, you may be able to find a closer and thus faster repository site i.e. in if you are in india you should look for an indian repository.



1
############# config ##################
#
# set base_path    /var/spool/apt-mirror
#
# set mirror_path  $base_path/mirror
# set skel_path    $base_path/skel
# set var_path     $base_path/var
# set cleanscript $var_path/clean.sh
# set defaultarch  
# set postmirror_script $var_path/postmirror.sh
# set run_postmirror 0
set nthreads     20
set _tilde 0
#
############# end config ##############
deb http://archive.ubuntu.com/ubuntu maverick main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu maverick-security main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu maverick-updates main restricted universe multiverse
#deb http://archive.ubuntu.com/ubuntu maverick-proposed main restricted universe multiverse
#deb http://archive.ubuntu.com/ubuntu maverick-backports main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu maverick main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu maverick-security main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu maverick-updates main restricted universe multiverse
#deb-src http://archive.ubuntu.com/ubuntu maverick-proposed main restricted universe multiverse
#deb-src http://archive.ubuntu.com/ubuntu maverick-backports main restricted universe multiverse
clean http://archive.ubuntu.com/ubuntu


i have added all the repositories for maverick you can add according to your requirement.


step 3: Now we run it for the first time.Now its going to take a lot of time so you should devote a few hours for it.But in case you want to stop it and restart it from there the is no problem as it continues from there.so you can just run it when no one is using the connection.

1
sudo apt-mirror /etc/apt/mirror.list

step4: Phew once that’s done you’ll get some instructions on how to clean up unwanted files. Follow those.They’ll probably ask you to run below
command,but double check with your output.

1
sudo /var/spool/apt-mirror/var/clean.sh


step 5: Now once done with the download we can add it in the cron file so that it get updated  every day.Run the command to edit the file

1
gksudo gedit /etc/cron.d/apt-mirror

just uncomment the # from the last line and it will be updated every day at 4:00 AM you can edit and also change the timing and interval.


step 6: Now lets see how to use this repository.The easiest way would be using a web server like apache.so install apache

1
sudo apt-get install apache


step 7:point the mirror to apache web directory

1
ln -s /var/spool/apt-mirror/mirror/archive.ubuntu.com/ubuntu /var/www/ubuntu

step 8: then add this repository in the machines you want to update.
for ex: if the machine can be  accessed by ajatus.in then just add

1
deb http://ajatus.in/ubuntu maverick main restricted universe multiverse.


This is how you can set up your own repository for ubuntu.


How to catch invisible friends on GTalk

Saturday, December 18th, 2010

I always wondered that there must be a way to catch friends off guard when they are invisible. Luckily I came across Python’s XMPP library which helped me. On ubuntu Linux you can install this module using apt.

1
$ sudo aptitude install python-xmpp python-dnspython

The complete script is as below . Open gedit or Vim and copy pate the below code. Save it as “track_invisible_users.py” Don’t forget to replace the username and password fields

?View Code PYTHON
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import xmpp
 
#constants
USER_ID = "youruserid@gmail.com"
PASSWORD = "yourpassowrd"
SERVER = "gmail.com"
 
jid=xmpp.protocol.JID(USER_ID)
C=xmpp.Client(jid.getDomain(),debug=[])
 
if not C.connect((SERVER,5222)):
    raise IOError('Can not connect to server.')
if not C.auth(jid.getNode(),PASSWORD):
    raise IOError('Can not auth with server.')
 
C.sendInitPresence(requestRoster=1)
 
def myPresenceHandler(con, event):
   if event.getType() == 'unavailable':
     print event.getFrom().getStripped()
 
C.RegisterHandler('presence', myPresenceHandler)
while C.Process(1):
  pass

After this run

python track_invisible_users.py 

Networking Ubuntu PCs with SSHFS

Sunday, October 18th, 2009

Two PCs that are both running on Ubuntu can share files in a number of ways. We use USB devices & swap them to synchronize files between two PCs in what was called a ‘sneaker network‘. One better way is to use an SSHFS or ‘Secure Shell File System’ network.

SSHFS uses OpenSSH to provide secure communication between PC’s/With the network connected the local PC user will be able to transfer,open as well as edit files on the remote PC as if they were on his own machine. The remote files will look and act just like the files on the local PC

To create an SSHFS network all you need are two PCs connected to the same router or gateway. Ubuntu comes with most of the software to make this work, but needs two applications available in the repositories to be initialized on both PCs. Here is how to set it up:

  1. From System>Administration>Synaptic Package Manager install the following packages: sshfs and openssh-server
  2. Also in Synaptic, confirm that openssh-client is installed(usually comes with Ubuntu)
  3. Go to System Administration>Users and Groups>unlock>Manage Groups, confirm on Fuse group
  4. Create an empty folder in your home directory

That completes the installation of the networking tools. To activate the network from one PC to the other,you just have to invoke SSHFS and indicate where the files are coming from, and where they are going to be displayed (that the new folder you made)

Go to Applications>Accessories>Terminal & enter:

1
 sshfs remoteusername@remotepc:/home/remoteusername ~/newfolder

Once you supply the password for remote PC (their password, not yours) which indicates that you have permission to access it, and for the first time only, confirm the other PC, then the network will be established and an icon will be displayed on your desktop. You will be able to access the other user’s home directory by simply clicking on that ‘newfolder’ icon in your home director.You can then copy,move,edit and delete as if they were on your PC. Password protected documents will, of course remain password protected.
To disconnect your PC from the network, enter in the terminal:

1
fusermount -u ~/newfolder

Installing Empathy

Monday, October 12th, 2009

In my last post I gave an insight on how empathy is a challenge for pidgin.Today I am going to run through the steps as found on livegnome.org for installation of empathy.

You can get the latest version of Empathy by changing your repositories as follows: First add the public key from the developers:

1
sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com FA3A1271

Next add the following repositories depending upon your Ubuntu version to /etc/apt/sources.lst or graphically in System->Administration->Synaptic Package Manager->Settings->Repositories:

For Jaunty(9.04) Users

deb http://ppa.launchpad.net/telepathy/ppa/ubuntu jaunty main
deb-src http://ppa.launchpad.net/telepathy/ppa/ubuntu jaunty main

For Intrepid(8.10) users

deb http://ppa.launchpad.net/telepathy/ppa/ubuntu intrepid main
deb-src http://ppa.launchpad.net/telepathy/ppa/ubuntu intrepid main

For Hardy(8.04) users

deb http://ppa.launchpad.net/telepathy/ppa/ubuntu hardy main
deb-src http://ppa.launchpad.net/telepathy/ppa/ubuntu hardy main

You then need to update the source list using the following command

1
sudo apt-get update


Installing the appropriate packages

Then in a terminal, enter the following command:

1
sudo apt-get install empathy telepathy-mission-control telepathy-stream-engine telepathy-gabble telepathy-butterfly telepathy-haze telepathy-idle telepathy-salut telepathy-sofiasip python-msn empathy-megaphone-applet

Optionally, you can add more functionality/integration with the following:

1
sudo apt-get install nautilus-sendto-universe galago-telepathy-feed libtelepathy-farsight0 python-tpfarsight galago-eds-feed python-galago python-galago-gtk

The application will show up in Applications->Internet->”Empathy Instant Messenger”