6 entries tagged with 'Linux'

How to access cherokee-admin from a remote machine

The cherokee-admin binds only to local loopback by default. There are some workarounds:

Tunneling

Create an SSH tunnel. This is the recommended way. In order to do so you must issue the following command:

[email protected]:~$ ssh -L 9090:localhost:9090 remote_IP

After that your terminal will be logged in the remote machine. There you can start the admin. From then on you can access this remote interface through http://localhost:9090. Every request will be forwarded to the remote IP running cherokee-admin.

The -b parameter

Launch cherokee-admin with the -b parameter in order to force it to listen to all the network interfaces.

Copy and paste

Finally you could always install cherokee on your local host, configure it there and then copy the generated cherokee.conf file to the device running the cherokee instance you wanted to set up.

How to ask questions the smart way

In the world of hackers, the kind of answers you get to your technical questions depends as much on the way you ask the questions as on the difficulty of developing the answer. This guide will teach you how to ask questions in a way more likely to get you a satisfactory answer. It is written by Eric S. Raymond, the author of the cathedral & the bazaar.

Howto get the UUID of a hard disk

What is the UUID?

The UUID library, present in all Linux systems, is used to generate unique identifiers for objects that may be accessible beyond the local system. The UUIDs generated by this library can be reasonably expected to be unique within a system, and unique across all systems. They could be used, for instance, to generate unique HTTP cookies across multiple web servers without communication between the servers, and without fear of a name clash. The UUIDs are also used to identify the hard disks on your Linux box.

Retrieve the UUID of your disk using blkid

The blkid program can be used to determine the type of content (e.g. filesystem, swap) a block device holds, and also attributes (tokens, NAME=value pairs) from the content metadata (e.g. LABEL or UUID fields).

[email protected]:~$ blkid /dev/sda5
/dev/sda5: UUID="21fb314a-b170-42b4-960a-07d7930b693f" TYPE="ext3"

The UUIDs of your disks can also be found in /dev/disk

[email protected]:~$ ls -al /dev/disk/by-uuid
total 0
drwxr-xr-x 2 root root 120 2009-10-14 10:31 .
drwxr-xr-x 5 root root 100 2009-10-14 10:31 ..
lrwxrwxrwx 1 root root  10 2009-10-14 10:31 0B7E-3FC3 -> ../../sda7
lrwxrwxrwx 1 root root  10 2009-10-14 10:31 21fb314a-b170-42b4-960a-07d7930b693f -> ../../sda5
lrwxrwxrwx 1 root root  10 2009-10-14 10:31 50340AA1340A8A64 -> ../../sda1
lrwxrwxrwx 1 root root  10 2009-10-14 10:31 9e83c2fe-b180-4b46-8b1c-b21eb1634895 -> ../../sda6

Use the vol_id command...

...when you want to see even more info on the hard disk:

[email protected]:~$ sudo vol_id /dev/sda5
ID_FS_USAGE=filesystem
ID_FS_TYPE=ext3
ID_FS_VERSION=1.0
ID_FS_UUID=21fb314a-b170-42b4-960a-07d7930b693f
ID_FS_UUID_ENC=21fb314a-b170-42b4-960a-07d7930b693f
ID_FS_LABEL=
ID_FS_LABEL_ENC=

Howto merge PDF documents

It is very simple to merge serveral PDF documents together into one PDF document. Just make sure that the gs package is installed on your system.

[email protected]:~$ gs -dNOPAUSE -sDEVICE=pdfwrite \
> -sOUTPUTFILE=result.pdf \
> -dBATCH one.pdf two.pdf three.pdf

This command will merge the thee PDF documents one.pdf, two.pdf and three.pdf into the resulting result.pdf document.

Howto create your own Ubuntu repository

Ubuntu and Debian packages are all bundled in something what is called a repository. Some people, like me, create their own:

Note

My repository links with the Jaunty distribution (that is Ubuntu 9.04). Your can connect yours to any other, like Debians experimental repository.

First create your own repository.

My repository is accessible over the web, so I installed it on my web server:

[email protected]:~$ cd /var/www/
[email protected]:/var/www$ sudo mkdir packages
[email protected]:/var/www$ cd packages/

In this /var/www/packages we will create a pool, the 'jaunty' distribution and the cache directories:

[email protected]:/var/www/packages$ sudo mkdir -p pool/main
[email protected]:/var/www/packages$ sudo mkdir -p dists/jaunty/main/binary-i386
[email protected]:/var/www/packages$ sudo mkdir .cache

Now two files need to be created. The first one is the apt-release.conf. Make sure that it looks like:

APT::FTPArchive::Release::Codename "jaunty";
APT::FTPArchive::Release::Origin "elevenbits.com";
APT::FTPArchive::Release::Components "main";
APT::FTPArchive::Release::Label "ElevenBits Ubuntu Repository";
APT::FTPArchive::Release::Architectures "i386";
APT::FTPArchive::Release::Suite "jaunty;

The second file is called apt-ftparchive.conf. This one should look like:

Dir {
     ArchiveDir ".";
     CacheDir "./.cache";
};

Default {
     Packages::Compress ". gzip bzip2";
     Contents::Compress ". gzip bzip2";
};

TreeDefault {
     BinCacheDB "packages-$(SECTION)-$(ARCH).db";
     Directory "pool/$(SECTION)";
     Packages "$(DIST)/$(SECTION)/binary-$(ARCH)/Packages";
     Contents "$(DIST)/Contents-$(ARCH)";
};

Tree "dists/jaunty" {
     Sections "main";
     Architectures "i386";
}

After you'd created these files your system should look like this:

[email protected]:/var/www/packages$ ls -al
total 28
drwxr-xr-x 5 root root 4096 Aug 14 13:32 .
drwxr-xr-x 3 root root 4096 Aug 14 13:22 ..
drwxr-xr-x 2 root root 4096 Aug 14 13:26 .cache
-rw-r--r-- 1 root root  427 Aug 14 13:32 apt-ftparchive.conf
-rw-r--r-- 1 root root  282 Aug 14 13:30 apt-release.conf
drwxr-xr-x 3 root root 4096 Aug 14 13:26 dists
drwxr-xr-x 3 root root 4096 Aug 14 13:26 pool

Add your own packages and update the repository.

Here the yourpackage package version 1.0 is copied into the new (empty) repository:

[email protected]:~$ cd /var/www/packages/pool/main
[email protected]:/var/www/packages/pool/main$ sudo cp ~/yourpackage_1.0_all.deb .

Now the repo needs to be initialized. This you can do using these commands:

[email protected]:~$ cd /var/www/packages
[email protected]:/var/www/packages$ sudo apt-ftparchive generate apt-ftparchive.conf
 pool/main: 1 files 9900B 0s
Done Packages, Starting contents.
dists/jaunty/Contents-i386: 1 files 9900B 0s
Done. 9900B in 1 archives. Took 0s
[email protected]:/var/www/packages$ apt-ftparchive -c apt-release.conf release dists/jaunty | sudo tee dists/jaunty/Release
Architectures: i386
Codename: jaunty
Components: main
Date: Mon, 17 Aug 2009 14:16:41 UTC
Label: ElevenBits Ubuntu Repository
Origin: elevenbits.com
Suite: jaunty
MD5Sum:
 1d25efc884e5bbfc32eeba74771e322e              536 main/binary-i386/Packages
 574c2e304fb14272b8f70355e93fbe80              416 main/binary-i386/Packages.bz2
 3a0cbc2e4a38e40c8182451c85de1251              390 main/binary-i386/Packages.gz
SHA1:
 949b9e9045f7698cd64abd4c1fa2261eb5d22f82              536 main/binary-i386/Packages
 6d5d5c841a8890b4491650f4f360d53158d16cc0              416 main/binary-i386/Packages.bz2
 eda59ba70dc9e9d65cf92076e33cb589a07de564              390 main/binary-i386/Packages.gz
SHA256:
 b30b4e68d8928785d132dbdc6bb4158e75e907e07f00a3b8d206030236b8f94a              536 main/binary-i386/Packages
 38b855ab6e0ce3111f986f26347871827e5e461af9b29b8ccf12773560f63caf              416 main/binary-i386/Packages.bz2
 1d1aec4f2cff1a3b71212083aabfc3f2003c88b70f1f0a2ef32bfbb94c2aa879              390 main/binary-i386/Packages.gz

After this, the repository is ready to be used. See http://localhost/packages to make sure.

Note

Remember to re-initialize the repo each time the /var/www/packages is altered.

Enable the repository on your client machines.

On the Ubuntu machines that need access to your repository, use

sudo vim /etc/apt/sources.list

to add in the repository address:

deb http://ww.xx.yy.zz/packages jaunty main

where ww.xx.yy.zz is the address where your server lives.

From now on the system has access to our own private repository. Cool, no?