Sunday, August 5, 2012

Fixing Zentyal 2.3 NO_PUBKEY error in apt-get update

Zentyal-2.3 requires following repository, and automatically adds this on your source.list.

 #/etc/apt/source.list.d/zentyal-archive.list
deb http://archive.zentyal.org/zentyal 2.3 main extra

This will automatically be added after you install "zentyal-core" package, or you add the repository using "add-apt-repository".

You will see following error in apt-get update.

W: GPG error: http://archive.zentyal.org 2.3 InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY BE3CB0952C31765E

You can not find any public key for this.

You can fix this by one of followings

- comment out zentyal's repository in source.list (/etc/apt/source.list.d/zentyal-archive.list)

- adding key of "archive.zentyal.org" with following commend if you trust them.


wget http://keys.zentyal.org/zentyal-2.3-archive.asc

sudo apt-key add zentyal-2.3-archive.asc && sudo apt-get update


Thursday, June 21, 2012

Open 2 Ports in Ubuntu Apache Web Server

Basically, it is impossible to open 2 ports at same time in an Apache process.
You need to understand that you will create a "virtual" web server to answer multiple ports.

Anyway, let's open the ports.


/etc/apache2/ports.conf

NameVirtualHost *:80
NameVirtualHost *:8000
Listen 80
Listen 8000

port 80 and port 8000 are opened, but port 8000 will not work even though you may see it as opened.

Create a "virtual" web server to answer port 8000.

Edit following;

/etc/apache2/sites-enabled

You may see a long configuration like...


<VirtualHost *:80>
        ServerAdmin webmaster@localhost

        DocumentRoot /var/www
        <Directory />
                Options FollowSymLinks

        ...........................

</VirtualHost>

Copy all text, and paste it at the bottom of the file.
And change the second virtual host's port as 8000.

 
<VirtualHost *:80>
        ServerAdmin webmaster@localhost

        DocumentRoot /var/www

        ...........................

</VirtualHost>
< VirtualHost *:8000>
        ServerAdmin webmaster@localhost


        ...........................

</VirtualHost>

That's it.

You can access 2 port after a restart.

sudo service apache2 restart



Saturday, November 19, 2011

Ubuntu as a wireless speaker of iPhone using Airport (ShAirPort)

What I wanted to do at first was to use my PC speaker as a wireless speaker to play music from iPhone directly without any wiring.

My first idea was to use bluetooth.
I had a hard time to set this up and finally succeeded to make an audio sink from iPhone using bluez(http://www.bluez.org/).
I could listen music with desktop speaker via bluetooth, but it was not so easy to make it running every time I want.

So I bought a bluetooth receiver.
(http://www.belkin.com/IWCatProductPage.process?Product_Id=508754)

This was very compatible and easy to use.
It automatically turned on only when it pairs with my iphone.
But I have not been using this because I was disappointed its sound quality.


Finally, I could do this with Apple's Airplay (http://www.apple.com/itunes/airplay/).
ShAirPort (https://github.com/albertz/shairport) can make Ubuntu to emulate airplay speaker.
It seems to me that ShAirPort was implemented to use Apple's private key(http://en.wikipedia.org/wiki/AirPlay#Reverse_engineering_AirTunes_and_AirPlay), so please use this at your own risk.
Also note that this instruction is from INSTALL.md in ShAirPort source.

1. download source of ShAirPort

https://github.com/albertz/shairport
Just click 'ZIP' icon, then you can download all source files in one zip archive.

*UPDATE*
I confirmed new version of shairport does not work with my fresh ubuntu 12.04.
I am not sure what has been changed, but old version of shairport still works on my fresh ubuntu 12.04.
If you don't mind, you may download old version of shairport below.
<http://www.mediafire.com/file/9pvazneb15hgxbm/albertz-shairport-83c1b71.zip>
You may compile and run it as described below.


2. unzip

Open terminal, go to the directory where you stored the source file and unzip.

$ cd Downloads
$ unzip albertz-shairport-83c1b71.zip
$ cd albertz-shairport-83c1b71

3. Install followings

$ sudo apt-get install build-essential libssl-dev libcrypt-openssl-rsa-perl libao-dev libio-socket-inet6-perl libwww-perl avahi-utils pkg-config

4. Compile

$ make

Make sure that you have no error.

5. Run

$ ./shairport.pl


That's it.
Now see your iPhone and make sure that you have ios version 5 or later.
You may play it with iPad, iPod and iTunes also.

You should see a new icon when you play a music,
just select new speaker in that menu.


Pros :
- All you need is just local network between iPhone and Ubuntu
- No quality loss
- Easy to configure
- Only few resource consumption

Cons :
- Consumes wireless bandwidth (802.11n is recommended)

uploading file to tftp server on ubuntu 10.04

It was strange for me that I had no problem on using tftp server earlier than Ubuntu 10.04.
I just could upload and download whatever I want only if I get enough permission.
However, it did not work as I expected on Ubuntu 10.04.
I got 'Permission Denied', 'File Not Found' or 'Forbidden directory' error with tftpd + xinetd, tftpd + openbsd-inetd or tftpd-hda.


I had to know that uploading file to a tftp server is not allowed for security reason.


The use of tftp(1) does not require an account or password on the remote system.  Due to the lack of authentication information, tftpd will allow only publicly readable files to be accessed.  Files containing the string ``/../'' or starting with ``../'' are not allowed.  Files may be written only if they already exist and are publicly writable.

So if you want to upload any file to tftp server without any limitation, use following configuration with tftpd-hda.


# /etc/default/tftpd-hpa

TFTP_USERNAME="tftp"
TFTP_DIRECTORY="/var/lib/tftpboot"
TFTP_ADDRESS="0.0.0.0:69"
TFTP_OPTIONS="--secure --create"

 '--create' option will let you upload anything without limitation, but you should pay enough attention for the security.