dimitris kalamaras

mathematics, social network analysis, free software…

Category: Linux (Page 2 of 3)

Revive your Asus EeePC 701 4G and build a media server and torrent client

So, I had this EeePC 701 4G waiting patiently in a box and decided to make something useful with it: A media server + a remote torrent client.

First things first, I decided to install Lubuntu 13.04 in our EeePC. It is a simple, light but ‘full’ linux distro, since it is 100% compatible with Ubuntu. I downloaded the alternate ISO, burned it to a USB flash and rebooted the machine. The installation was smooth (it took ~40 minutes) and after rebooting to LXDE I was happy to see 1GB of free space in the 4GB SSD disk. Furthermore, everything worked OK: sound, graphics, greek support, etc. It was time to start the real fun part…

Read More

How to connect to PPTP-based VPN from Linux

Do you need to connect to a Windows VPN from Linux command line? It’s simple even though the Point-to-Point Tunneling Protocol (PPTP) is proprietary. First, install the pptp client for the linux command line:

sudo apt-get install pptp-linux

Then create a new file called chap-secrets, inside /etc/ppp:

sudo vim /etc/ppp/chap-secrets

This file is where your VPN username and password will be kept. Add this line to it:

your_username      PPTP    your_password        *

Apparently, you need to change ‘your_username’ and ‘your_password’ to your own. The ‘PPTP’ is just a name you give to remote server. You might want to change it to something else. It doesn’t really matter.

Next, create the basic configuration file for pptp-linux. This file must be kept inside /etc/ppp/peers but you can name it anyway you want. Let’s say, you name it ‘cnc’:

sudo vim /etc/ppp/peers/cnc

Inside the new file, add the following lines:

pty "pptp REMOTE_SERVER_IP --nolaunchpppd" 
name your_username    #use the same name you used in chap-secrets
remotename PPTP       #use the same remote name you used in chap-secrets
ipparam cnc           #use the same name you used in naming this file
require-mppe-128      #encrypt all traffic using 128-bit encryption
file /etc/ppp/options.pptp #use standard PPP options when connecting

Apparently, you need to change REMOTE_SERVER_IP to the IP address of your VPN server.

Finally, create a new script inside /etc/ppp/ip-up.d to route traffic through the new ppp0 device. This script will be running every time ppp is up. Use any filename you like. I used ‘my_traffic’.

sudo vim /etc/ppp/ip-up.d/my_traffic

As you see in this example, I use 10.172.16.0/24 to force the kernel to route all packets directed to the IP range 10.172.16.0 – 10.172.16.254 to go through PPTP:

#!/bin/bash
route add -net 10.172.16.0/24 dev ppp0

Apparently, you need to change the ‘10.172.16.0’ part with the IP range of your remote network.

That’s all! Connect with this simple command:

sudo pon cnc

In parallel, you can watch for PPTP messages with

tail -f /var/log/syslog

You need to see something like that:

Sep 14 02:09:30 vaio pppd[4516]: local IP address 10.172.16.249
Sep 14 02:09:30 vaio pppd[4516]: remote IP address 10.49.217.

This means that you have acquired a VPN IP and you are probably OK. Check ifconfig to be sure.

If you manage to connect to your VPN, you will be able to ping to the above IP range, ssh to them, etc, just like as you were in office.

When you are done, disconnect with this command:

sudo poff cnc

How-to configure file sharing in KDE4/Samba

Simple. At least in Debian, Kubuntu and other Debian-derivatives. Install Samba server and the appropriate KDE4 module as root:

# apt-get install samba kdenetwork-filesharing

The kdenetwork-filesharing package installs a nice System Settings panel to configure network file-sharing using NFS and Samba. It also adds (the initially missing) functionality in the Properties > Share tab of each file and folder in Dolphin.

So, install the above packages, then open Dolphin, select a folder, right-click on it and select Properties then go to Share tab. Click on Configure File Sharing button and a new dialog appears. Let the “Simple Sharing” option intact and click on the Add button. A new dialog appears where you select and add the desired folder. Click OK twice. You are done.

Name-based Virtual Hosts in Apache

Name-based virtual hosting enables us to serve different domains from a single server. All we need is to add this line to /etc/apache2/sites-available/default:

NameVirtualHost *

The * specifies that Apache will serve requests for all IP addresses; optionally we can specify only a certain IP on the server.

Next, we create a new for each different domain we want to serve.

This can be done either by adding a few lines inside /etc/apache2/sites-available/default

<VirtualHost *>
    ServerName www.lxf.gr
    ServerAlias lxf.org
    DocumentRoot /media/oxy/www/lxf
</VirtualHost>

or by creating a new file (i.e. lxf.gr) inside /etc/apache2/sites-available

<VirtualHost *>
 ServerAdmin [email protected]
 ServerName lxf.gr
 ServerAlias lxf.gr
 DocumentRoot /media/oxy/www/lxf
 <Directory /media/oxy/www/lxf>
  Options Indexes FollowSymLinks
  Options -MultiViews
  AllowOverride All
  Order allow,deny
  Allow from all
 </Directory>
 CustomLog /var/log/apache2/lxf-access.log combined
 ServerSignature On
</VirtualHost>

and symlinking it to /etc/apache2/sites-enabled:

sudo ln -s /etc/apache2/sites-available/lxf  /etc/apache2/sites-enabled/

Technorati Tags: ,

free space is important!

That is the lesson I have learned today.

Despite my eagerness to update my N900 to Maemo 5 v10.2010, the software update tool kept giving me the following cryptic message:

not enough memory in target location

Wtf? The message was a surprise for me, since I thought the 32GB of my N900 would be more than enough for an 113.1MB update. But…Rootfs partition in n900 amounts only to 227MB, which apparently was nearly consumed by all the silly tools I have installed recently (mc, gnu-tar, openssh, lighttpd (yep, I run a web server on my mobile phone!), numpty-physics, bouncy, scummvm etc), along with ovi maps, micro-blogging app, etc.

After a while searching the Internet, I ended up in the maemo.org excellent wiki which of course was giving some usual-space-saving linux tips:

apt-get clean
apt-get autoremove

along with some more unusual (to me!) ‘opt-ifications’.

What’s that? The maemo slang for “move whatever can be moved from /usr to /home/opt”. For instance, you can easily mv nokia-maps from /usr/share to /home/opt and then ln -s back to where it was, so that the relevant application could run. Using this technique I managed to free almost 60MB in rootfs.

Now the update is underway and I am eager to see what’s new.

 

I’ve got Linux in my pocket too!

Yeeeeeeeeeeah! I am now yet another proud Nokia N900 owner!

Nokia N900 (Image from NOKIA)

Nokia N900 (Image from NOKIA)

This device runs Linux on an ARM Cortex 600MHz CPU, 1GB RAM and 32GB HDD, and it is more a portable computer than a mobile phone, thanks to its 3.5” touch screen (800×480 resolution) and the embedded keyboard. Right now, my N900 is still charging (minimum 6 hours initial charge I was told!) so I haven’t had the chance to play with it yet, but I plan to explore it tomorrow evening. Stay tuned!

melux: a custom ubuntu iso creation script!

When I was working for the Greek Linux Format, I was making special editions of Ubuntu for the magazine’s DVD. Those were the same distro of course, but with a lot more packages preinstalled. For that purpose, I had written all the useful info and relevant commands inside a text file. Of course, that wasn’t highly efficient, since I had to manually run through (read: copy/paste) all the commands again and again for every new custom Ubuntu image. So, I was always thinking that I should assemble and automate all those commands in a nice Bash script, but I never really tried it. This week, I finally decided to build that script and share it with everyone. So, I hereby give you Melux 1.0 (see full code below).

Read More

Page 2 of 3

Creative Commons License
Licensed under a Creative Commons Attribution-ShareAlike 4.0 International License - Powered by Linux