Posts Tagged ‘apt’

My Server

16, March 2011

Laptop Server
The Server I use is an Aspire Laptop, 5633WLM Core 2 Duo T5500 1.66 GHz with 1Gb of RAM with a missing screen [don’t ask] with a standard install of Xubuntu. I’ve built a rack so that it stands upright so save space and it is linked to my monitor via a KVM switch. It runs an Apache web server, an Apt cache server, backup server to an attached USB Hard Drive, the Folding@Home application, Torrent Server, a bunch of other cron run scripts and the Mediatomb Media Server.

Home Server

Home Server

Apt Server
Apache Server
Folding@Home
Torrent Server

Advertisements

APT Locked

20, October 2010

apt-get update error

Trying to update apt gives error message;

$ sudo apt-get update

error message;

E: Could not get lock /var/lib/apt/lists/lock – open (11: Resource temporarily unavailable)
E: Unable to lock the list directory

To fix it remove the lock with;

$ sudo rm /var/lib/apt/lists/lock

10 Things to Do After installing Maverick

20, October 2010

Before you mess, backup the sources.list with;
$ sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak

1] Select a new wallpaper as the wallpaper has not improved since the purple tie dyed T Shirt look of Lucid. Right Click the desktop and select [Change Desktop Background] and select any other wallpaper from the defaults or one of your own.

2] remove the revolting purple background to the graphical login window, install GDM2 Setup

GDM2 Setup, A login interface management utility for the new GDM. Allows for wallpaper setting, autologin option, prompted or userlist login, etc.

The setup utility that comes in Ubuntu Karmic (and many other Gnome based distros) is missing most of the older GDM setup utility’s functionality. This application puts the functionality back in the hands of the users through a familiar and simple GUI. https://launchpad.net/gdm2setup
Add this empty directory first [the program halts if it can’t find it, a bug https://bugs.launchpad.net/gdm2setup/+bug/560130 that should have been sorted by now guys];

$ sudo mkdir /usr/share/images/xsplash

Add source with;

$ sudo add-apt-repository ppa:gdm2setup/gdm2setup

there is no Maverick repo yet, so you then need to open [System], [Administration], [Synaptic Package manager], {settings], [Repositories] and click on the “other Software” Tab. Now highlight the gdm2setup line and select [Edit] and change Maverick back to Lucid and close.

then update

$ sudo apt-get update

now add the program

$ sudo apt-get install python-gdm2setup

Then find the program called Login Screen (GDM2Setup) in [System], [Administration]

3] Swap the Close/Min & Max buttons back to the Right on the Windows, try if for a while first as it hear to stay! “windicators” are on their way for right hand side.

Install Ubuntu Tweak http://ubuntu-tweak.com/

Add Ubuntu Tweak source
$ sudo add-apt-repository ppa:tualatrix/ppa

$ sudo apt-get update

$ sudo apt-get install ubuntu-tweak

Then find the program called Ubuntu Tweak in [Applications], [System Tools] and in the program select [Windows Manager Settings], [Windows Titlebar Button Layout]

4] Remove the Social networking/message notification indicators i.e. the new “me” menu and the “envelope” from the top Right Hand notification area, I’m not Social and proud of it :-).

remove me-menu with;

$ sudo apt-get remove -y indicator-me

remove the envelope with;

$ sudo apt-get remove -y indicator-messages

both will disapear on rebooting the desktop.

5] Add the Gnome Configuration Editor to your menus. Right Click on the [Application] menu and select [Edit Menus], then select [System Tools] and place a tick in the box next to [Configuration Editor] and then select [Close]. Now select [Applications], [System Tools] then [Configuration Editor]

6] Remove the 60 second to shutdown confirmation message. Open the Configuration Editor [see 4 above] in Applications, [System Tools] now using the left-hand menu select [apps], then [indicator-sessions] and tick the box next to [ suppress_logout_restart_shutdown ] then [File], [Quit]

Or in a Terminal;
$ gconftool-2 --type Boolean --set /apps/indicator-session/suppress_logout_restart_shutdown True

7] Updates: revert back to the update icon in the top toolbar, open Gnome Configuration Editor [see 4 above], then navigate to [apps], [update-notifier] and untick the [auto-launch] option, then change the [regular_auto_launch_interval] to zero, then [File], [Quit] and reboot your PC.

Or in a Terminal;
$ gconftool-2 --type Boolean --set /apps/update-notifier/auto_launch False
and
$ gconftool-2 --type int --set /apps/update-notifier/regular_auto_launch_interval 0

8] Hate the Nautilus bread-crumb file path?, switch back to the text file path with Ctrl+l or / and back again with Esc. You can also switch permanently by opening the Gnome Configuration Editor [see 4 above], then navigate to [apps], [nautilus], [preferences] and putting a tick in the always_use_location_entry box.

9] Get Flash working in Firefox: Open Firefox and access [Tools], [Add-ons], select the [Get Add-ons] Tab and then [Browse All add-ons] then search for FLASH-AID and install it and follow the on screen instructions.

10] Enjoy…..

An Apt Server using apt-cacher-ng

17, May 2009

I decided that due the increasing number of PC’s and laptops in the house all requiring the same package downloads from Ubuntu that downloading them once to a server and then serving them onto the various other machines was a better use of my broadband bandwidth. I therefore decided to install apt-cacher following this post with some changes, the main one being I used the Debian version of apt-cacher called apt-cacher-ng.

The PC I used for this is a laptop with a missing screen [don’t ask] with a standard install of Ubuntu.

First install apt-cacher-ng by copying & pasting the following into a terminal after the prompt;

sudo apt-get install apt-cacher-ng

and test that the service is running by typing this to http://your_server_name:3142/apt-cacher-ng into your web browser changing the your_server_name to the name of your server or it’s ip address. When I installed Ubuntu on my server I called the PC bob during the installation therefore I used http://bob:3142/apt-cacher-ng. You can also use http://[localhost]:3142/ the page that gets displayed is an error page with info. and links to various web pages.

If you want to change any of the settings in the apt-cacher config file then, copy & paste the following into your Terminal;

sudo gedit /etc/apt-cacher-ng/acng.conf

I changed the location of the Cache directory so that it was outside my o/s partition and within my home partition as the folder get quite large. If you do this then you need to change the permissions on the folder to add the apt-catcher-ng user group.

sudo chown -R apt-cacher-ng.apt-cacher-ng /Path/To/Your/New/apt-cache-archive

you can now update the repository source list on the server & all the client PC’s or add the redirection in /etc/apt/apt.conf.d/.

Redirection Method

adding a file called 02proxy to /etc/apt/apt.conf.d/ to redirect apt/synaptic requests via server to apt-cacher.
In a Terminal;

touch ~/02proxy

this creates a file called 02proxy in your home folder.

echo ‘Acquire::http { Proxy “http://bob:3142”; };’ >> ~/02proxy

change bob to your server name, this adds the line Acquire::http { Proxy “http://bob:3142”; };  to the file

sudo mv ~/02proxy /etc/apt/apt.conf.d/02proxy

this moves the file from your home folder to /etc/apt/apt.conf.d/

now go to “continue from here” below.

The source.list Method

Backup first In a terminal copy & paste;

sudo cp /etc/apt/sources.list /etc/apt/sources.list.backup

to make a backup of the list in the same directory, then there are a couple of options to amend the sources.list file;

Option :1

sudo gedit /etc/apt/sources.list

when this opens you need to insert your_server_name:3142 in every line, i.e.

deb http://archive.ubuntu.com/ubuntu/ Jaunty main restricted

becomes

deb http://your_server_name:3142/archive.ubuntu.com/ubuntu/ Jaunty main restricted

which made mine look like this;

deb http://bob:3142/archive.ubuntu.com/ubuntu/ Jaunty main restricted

you can use the search and replace option in gedit to make this a faster process then save and close it.

Option :2

Another option is to open a Terminal and type;

sudo sed -i ‘s/http:\/\//http:\/\/bob:3142\//g’ /etc/apt/sources.list

this uses sed to search for the string http:// in each line of the sources.list file and replace it with http://bob:3142/, you just need to replace bob with the name of your server.

continue from here;

now restart the apt-cacher-ng

sudo /etc/init.d/apt-cacher-ng stop

sudo /etc/init.d/apt-cacher-ng start

if you get a permissions error here check the permissions on your new apt archive folder.

and update the source list with

sudo apt-get update

to update the package list.

if you get errors it’s worth rebooting the PC and trying again especially if you changed any details in the conf file.

Once the update has run you should see that it has placed several directories and files in the Cache directory at /var/cache/apt-cacher-ng or wherever you moved it too.

Now go to your client PC and after updating it’s source list run the apt-get update command to make sure that works ok.

Now we need to import any existing packages in the servers apt-get cache into the apt-cacher-ng cache, so copy and paste into a Terminal;

$ test -x /var/cache/apt-cacher-ng/_import || sudo mkdir -p -m 2755 /var/cache/apt-cacher-ng/_import

change the path if you have moved the cache ddirectory, this creates a new directory called _import within it.

Now in a Terminal;

$ cd /var/cache/apt/archives

import the old packages with:

sudo  cp *.* /var/cache/apt-cacher-ng/_import

Now open the apt-cacher-ng info. page at http://your_server-name:3142/acng-report.html

scroll down to the bottom of the page and hit the import button. After a while the import should finish and you should notice an increase in the space in the disk space that the cache directory takes.

You can now remove the _import directory with;

$ sudo rm -fr /var/cache/apt-cacher-ng/_import

and the old apt cache with;

$ sudo rm -fr /var/cache/apt/archives/*.deb

to save space.

Now download a different packages on each of your PC’s so that you can check each PC’s downloads are going into the apt-cacher-ng cache on the server. The only way I found to do this was to check the number of files in the cache at /var/cache/apt-cacher-ng using properties then add a package and re check to see if the count increased.

The apt-catcher-ng service produces a report at http://your_server_name:3142/acng-report.html i.e. mine is at http://bob:3142/acng-report.html.