In Linux
12Oct 09

A lot of people especially Linux die hards will believe this is a waste of time and why bother,  just run a full Linux distro and forget Windows.  I was a bit the same at first,  but them I thought about it and realised at work I am forced to used Windows and find I still want to use Linux to do some tasks.  With a laptop that isnt the most powerfull thing out there Virtualisation isnt an option,  so I tried Portable Ubuntu and works pretty well.

The Installation is very easy, all you need is a minimum 2Gig USB flash drive or similar.  The HowTo is here:   http://www.pendrivelinux.com/colinux-portable-ubuntu-for-windows/#more-1476

Enjoy


Linux CLI Commands Pt 2

Posted by admin
In Linux
9Oct 09

Ok,  Ive started again and finished a detailed list of all the main commands,  hope you find it usefull.

FILE COMMANDS

ls – directory listing
ls -al – formatted listing with hidden files
cd dir – change directory to dir
cd – change to home
pwd – show current directory
mkdir dir – create a directory dir
rm file – delete file
rm -r dir – delete directory dir
rm -f file – force remove file
rm -rf dir – force remove directory dir *
cp file1 file2 – copy file1 to file2
cp -r dir1 dir2 – copy dir1 to dir2; create dir2 if it doesn’t exist
mv file1 file2 – rename or move file1 to file2 if file2 is an existing directory, moves file1 into directory file2
ln -s file link – create symbolic link link to file
touch file – create or update file
cat > file – places standard input into file
more file – output the contents of file
head file – output the first 10 lines of file
tail file – output the last 10 lines of file
tail -f file – output the contents of file as it grows, starting with the last 10 lines Process Management

PROCESS CONTROL

ps – display your currently active processes
top – display all running processes
kill pid – kill process id pid
killall proc – kill all processes named proc *
bg – lists stopped or background jobs; resume a stopped job in the background
fg – brings the most recent job to foreground
fg n – brings job n to the foreground

FILE PERMISSIONS

chmod octal file – change the permissions of file to octal, which can be found separately or user, group, and world by adding:
● 4 – read (r)
● 2 – write (w)
● 1 – execute (x)
Examples:
chmod 777 – read, write, execute for all
chmod 755 – rwx for owner, rx for group and world For more options, see man chmod.

SSH

ssh user@host – connect to host as user
ssh -p port user@host – connect to host on port port as user
ssh-copy-id user@host – add your key to host for user to enable a keyed or passwordless login

SEARCHING

grep pattern files – search for pattern in files
grep -r pattern dir – search recursively for pattern in dir

command | grep pattern – search for pattern in the output of command

locate file – find all instances of file

SYSTEM INFO

date – show the current date and time
cal – show this month’s calendar
uptime – show current uptime
w – display who is online
whoami – who you are logged in as
finger user – display information about user
uname -a – show kernel information
cat /proc/cpuinfo – cpu information
cat /proc/meminfo – memory information
man command – show the manual for command
df – show disk usage
du
– show directory space usage
free – show memory and swap usage
whereis app – show possible locations of app
which app – show which app will be run by default

COMPRESSION

tar cf file.tar files – create a tar named file.tar containing files
tar xf file.tar – extract the files from file.tar
tar czf file.tar.gz files – create a tar with Gzip compression
tar xzf file.tar.gz – extract a tar using Gzip
tar cjf file.tar.bz2 – create a tar with Bzip2 compression
tar xjf file.tar.bz2 – extract a tar using Bzip2
gzip file – compresses file and renames it to file.gz
gzip -d file.gz – decompresses file.gz back to file

NETWORK

ping host – ping host and output results
whois domain – get whois information for domain
dig domain – get DNS information for domain
dig -x host – reverse lookup host
wget file – download file
wget -c file – continue a stopped download

INSTALLATION

Install from source:
./configure
make
make install
dpkg -i pkg.deb – install a package (Debian)
rpm -Uvh pkg.rpm – install a package (RPM)

SHORTCUTS

Ctrl+C – halts the current command
Ctrl+Z – stops the current command, resume with fg in the foreground or bg in the background
Ctrl+D – log out of current session, similar to exit
Ctrl+W – erases one word in the current line
Ctrl+U – erases the whole line
Ctrl+R – type to bring up a recent command
!! – repeats the last command
exit – log out of current session

* use with extreme caution.



In Linux
29Sep 09

Sockso is a cross platform music server and requires no installation. It runs on a standalone PC or Server. This guide is for running Sockso on a Server platform,   to install and run with a GUI on a PC refer to the Sockso Web site.

Sockso gives you the ability to stream all your music  – Supports MP3, OGG Vorbis, Flac and WMA,  anytime, anywhere via a web interface through your browser.  All that you require is Flash on your client end and a decent internet connection minimum should have at least IEEE 802.11g (54M) Wifi connection for smooth operation.

Sockso requires Sun Java only, no Apache or other web server is require to run.

So,  lets start:

1 )

Sockso requires Sun Java to work. You should install the following packages.

sudo apt-get install sun-java6-bin sun-java6-fonts sun-java6-jre unzip

2 )

Download the latest version of Sockso. The current version is 1.2 at the time of this writing.

wget http://sockso.googlecode.com/files/sockso-1.2.zip

unzip sockso-1.2.zip

sudo mkdir /usr/share/sockso

sudo cp -R /home/user/sockso-1.2/* /usr/share/sockso/

sudo mkdir /var/sockso
sudo chmod -R 0755 /var/sockso

Step )

Run the Sockso at command prompt.

sudo sh /usr/share/sockso/linux.sh --nogui --datadir /var/sockso

To add your music collection, enter the directory path for all you music.  You can enter multiple paths eg. If you had to different directories with music, /home/user/music and /home/user2/mp3, just run the following command to populate your collection:

#SockSo#>coladd /home/samiux/music
#SockSo#>coladd /home/mary/mp3

To list all collection directory paths, use the following command.
collist

To delete a directory from the collection, use the following command.
coldel

Adding users to Sockso.

#SockSo#>useradd samiux <your_password_here> samiux@gmail.com

To exit the #SockSo#> command prompt.
exit

4)

Copy the init.d script to /etc/init.d/

sudo cp /usr/share/sockso/scripts/init.d/sockso /etc/init.d/sockso.pl

Create a sockso script file.

sudo nano /etc/init.d/sockso

-------- CUT HERE ---------
#!/bin/bash

perl /etc/init.d/sockso.pl $1

exit 0
-------- CUT HERE ---------

Edit the sockso.pl as the following.

sudo nano /etc/init.d/sockso.pl

system( 'sh linux.sh --nogui --datadir /var/sockso > /dev/null 2>&1 &' );

use constant SOCKSO_DIR => "/usr/share/sockso/";

5)

Make the scripts executable:

sudo chmod +x /etc/init.d/sockso
sudo chmod +x /etc/init.d/sockso.pl

Now, you can start the sockso with the following command

sudo /etc/init.d/sockso start

You can also stop the sockso with the following command.

sudo /etc/init.d/sockso stop

To connect to your Sockso Web Interface enter the IP or FQDN of your server.

http://192.168.0.1:4444

6)

To run the script automatically after reboot update the rc.d with.

sudo update-rc.d sockso defaults

Using MySQL as a backend

By default Sockso uses the Java database engine HSQLDB. This provides a nice fast easy way to get a database up and running in an application and works excellently for most uses of Sockso.

With a very large collection you may run into some performance problems and possibly “out of memory” errors when accessing some of the pages.   In these cases you have the option of changing the database engine Sockso uses, and for this MySQL support is available.

NB: Sockso requires MySQL 5+

1) Download Sockso’s Optional Components

You will need to install the optional components first to use MySQL.

2) Create the database

You  will need to create a MySQL database for Sockso to use. It doesn’t need to have any tables in it, Sockso will create all of these when it starts up, but the database does need to exist.

3) Start Sockso with MySQL

When the database is created, start Sockso with the following command line switches (changing the values to match your set up obviously) which tell it to use MySQL, and the connection information for the database.

$> java -jar sockso.jar --dbtype=mysql \
      --dbhost=localhost \
      --dbuser=myuser \
      --dbpass=secret \
      --dbname=socksodb

Sockso will now be running with MySQL.

NB: This will be a completely blank database.

NOTEs :

  • Make sure you have stopped the Sockso before reboot or shutdown; otherwise, the mp3 databases would be corrupted. If so, you should delete everything inside /var/sockso and redo the Step 3.
  • · Broadcasting copyrighted music can lead to heavy fines or even lawsuits.
  • For more detailed information and questions refer to the Sockso Website http://sockso.pu-gh.com/ or forums http://forums.pu-gh.com/

In Linux
28Sep 09

This is the quick and easy way,  compared to going to the Java website downloading then installing etc etc etc.

sudo apt-get install openjdk-6-jre
sudo update-alternatives –config java
java -version


All done :)


In Linux
28Sep 09

Ever had the issue with which you wish to send a file to someone when you are chatting via IM or in the middle of a gaming session etc and find its too big to send via your IM client and emailing is too much trouble at the time.  Well this small application is for you.  Its quick, efficient and easy.

There are a lot of tools to tackle this problem. For large scale communities there are dozens of   networks. However, they don’t work for small local networks. One way is to put your stuff  on a local  server to share, but maintaining this can be tedious. Tools like the ingenious npush/npoll are extremely helpful, provided that both parties have it installed, SAFT/sendfile also aims to solve this problem, but needs a permanently running daemon…

Woof (Web Offer One File) tries a different approach. It assumes that everybody has a web-browser or a commandline web-client installed. Woof is a small simple stupid webserver that can easily be invoked on a single file. Your partner can access the file with tools he trusts (e.g. wget). No need to enter passwords on keyboards where you don’t know about keyboard sniffers, no need to start a huge lot of infrastructure, just do a

     $ woof filename

and tell the recipient the URL woof spits out. When he got that file, woof will quit and everything is done.

And when someone wants to send you a file, woof has a switch to offer itself, so he can get woof and offer a file to you.

Prerequisites and usage

Woof needs Python on a unix’ish operating system. Some people have used it successfully on Windows within the cygwin environment.

    Usage: woof [-i <ip_addr>] [-p <port>] [-c <count>] <file>

           woof [-i <ip_addr>] [-p <port>] [-c <count>] [-z|-j|-Z|-u] <dir>

           woof [-i <ip_addr>] [-p <port>] [-c <count>] -s

    Serves a single file <count> times via http on port <port> on IP

    address <ip_addr>.

    When a directory is specified, an tar archive gets served. By default

    it is gzip compressed. You can specify -z for gzip compression,

    -j for bzip2 compression, -Z for ZIP compression or -u for no compression.

    You can configure your default compression method in the configuration

    file described below.

    When -s is specified instead of a filename, woof distributes itself.

    defaults: count = 1, port = 8080

    You can specify different defaults in two locations: /etc/woofrc

    and ~/.woofrc can be INI-style config files containing the default

    port and the default count. The file in the home directory takes

    precedence. The compression methods are "off", "gz", "bz2" or "zip".

    Sample file:

        [main]

        port = 8008

        count = 2

        ip = 127.0.0.1

        compressed = gz

It can be downloaded from HERE

In Linux
5May 09

After years of using SME server – I really like SME for its simple but effective package, and Clarkconnect – never again, I decided to take a big step and build a custom server from scratch built on Ubuntu Server 8.10, which turned out to be alot easier than expected. I had all services – File Sharing, SSL, Web server, mysql, FTP and torrent engine (see my torrentflux tutorial) up and running smoothly in about an hour. The only thing that stopped my in my tracks was setting up an email server…..

I searched the net for days reading a number a tutorials all saying something slightly different. I made several attemps to get the all the required applications working together with no success, and eventually gave up. I found that all the tutorials have some niggling problem that none of the forums could workout completel or made dodgy work arounds. Or they just plain didnt work.

So I have devised my own setup, which admittedly is a little more bulky but a hell of a lot easier to get up and running. For all the people that have given up try this.

Firstly, I am running Ubuntu 8.10 server Ed, so I cannot vouch for this elsewhere although it should work on all distros without hitch.

So the quick and simple solution I put together was to create a Virtual machine with VMware2 -a better version for server as it has a web interface ( see my VMware tutorial). With that in place I installed an SME server setup to be only an email server.

This will give up a functioning email with webmail with only a small and easy configuration on installation.

The Next step is to link the two with LDAP…

To be continued.




VMware Server is a proprietary virtualization software package made available for no cost from the VMware website. VMware Server allows you to run entire operating systems in a virtual machine, which run on top of Ubuntu. This guide provides instructions on installing, configuring and running VMware Server and VMware Server Console on Ubuntu. VMware server may be used on Desktop and Server editions of Ubuntu.

Installation and Quick Start

Ubuntu 8.10 (VMWare Server 2.0.0 Build 122956)

There is no package yet available. You can download it athttp://www.vmware.com/go/getserver

  1. Get a serial number (displayed at the download page link received by email as part of the registration process)
  2. Download the tar.gz file to your home directory
  3. Install required packages

sudo apt-get install build-essential linux-headers-`uname -r`

  1. Download the required patch athttp://ubuntuforums.org/attachment.php?attachmentid=94477&d=1227872015 and save in your home directory

  2. Unpack, apply patch and run vmware-install.pl

cd ~

tar zxvf VMware-server-2.0.0-122956.i386.tar.gz

cd vmware-server-distrib

sudo patch ./bin/vmware-config.pl ~/vmware-config.pl.patch

sudo ./vmware-install.pl

  1. Follow the settings displayed at your screen and don’t change default values if not necessary. Be sure to add your normal username as VMware Server administrator

  2. Enter the serial number when prompted
  3. Vmware2 has a web interface. Browse with Firefox to http://localhost:8222.

  4. Log in with your normal username and password

Note: You can also access the web interface via SSL at https://localhost:8333. You will probably need to add this site to your SSL Exception sites on your browser.

Installing VMware Tools on an Ubuntu VMware guest system

Installing VMware Tools inside your virtual machines can improve their performance. For information about speeding up your Ubuntu virtual machines see VMware/Tools


In Linux
9Apr 09

This is how to create a high-available gateway/firewall with ClarkConnect http://www.clarkconnect.com and the http://www.linuxvirtualserver.org/ solution.

Two ClarkConnect systems will be installed: one master server and one slave server. The master and slave run in parallel Only one of the systems is “live” If the master fails, the slave will automatically take over If the slave fails, well… the master is still doing its job

http://www.clarkconnect.com/docs/Howtos_-_Clustering_with_LVS



I have just added Torrent Flux to my ClarkConnect Server (ver 4.2).

It now has given me a web-based system for managing bit torrent file transfers. Letting me manage all aspects of torrent transfers through the secure web interface from anywhere you can get Internet access! It even lets you set your system up to subscribe to (& auto-download) rss torrent feeds and start your transfers while you’re away (during the night, as other transfers finish, or however else you like if you write script!).

The transfer themselves are performed on top of the Bit Tornado package, TorrentFlux provides a web interface for these scripts and the ability to manage multiple transfers, users and even protocols (receive completed files via http) all from the web gui.

Install is as follows

I will be using torrentflux-b4rt. It installed with alot less greif than the main version.

You will need a working installation of php and mysqlwhich you should have running on your server, follow the instructions to upgrade php and install php-cli should you need to, using the php5 repository listed here
http://www.clarkconnect.com/developer/betas/20070420.php

download and untar the torrentflux tarball, using Code:

cd /var/tmp

wget http://gunblade.fakap.net/doc/torrentfl … a2.tar.bz2 (this mirror actually works, I had a lot of trouble with the downloads fromthe actual site… weird??)

tar jvxf torrentflux-b4rt_1.0-beta2.tar.bz2

move the html directory to your website root, like so Code:

cd torrentflux-b4rt

Rename the file to what you like, I used torrentfluxb4rt (remember it)

mv html /var/www/html/torrentfluxb4rt

point your browser at http://yourCCIPaddress/torrentfluxb4rt/setup.php
follow through the install process, add in a name for the mysql server and a username and password, and tick the box that says create table. The setup will create the database as well as fill it so no need to create one through phpmyadmin or mysql.

You will need to make the config directory writeable, like so:
Code:

chmod 777 /var/www/html/torrentfluxb4rt/inc/config

The setup should finish, it may complain about some missing commands for optional components but these are fine.

Delete or rename the setup.php Code:

rm /var/www/html/torrentfluxb4rt/setup.php
or
mv /var/www/html/torrentfluxb4rt/setup.php /var/www/html/torrentfluxb4rt/has_setup.php

Point your browser at

http://yourCCIPaddress/torrentfluxb4rt/

and login. The first time you login will be your admin account so remember your password!

Your now ready to download torrents to your hearts content !!

Have fun :mrgreen:


Linux CLI syntax part 1.

Posted by admin
In Linux
9Apr 09

The following commands are generally the main ones you will need to navigate your way around the Terminal. Obviously there are more in depth commands but they will not be covered here (I may get around to posting and Advanced Command Line Syntax, so stay tuned if thats what your after)
Also, some of these comeands are based around Ubuntu as that is what I predominatly use. :)

Common Commands

ls- list directory contents, can be run as ls -la (’list’ mode, and ‘all’ files) to show a detailed listing
cd- change directory, eg cd /tmp
cp- copy files and directories, eg. cp work.txt /home/stuart.
mv- move files or directories, same notation as cp, also used to rename
rm- remove files or directories, eg.rm work.txt. Use rm -rf to remove a directory and all its contents.
mkdir- make a new directory; use rmdir to remove an empty directory
cat- view files, eg. cat work.txt. Be sure to only use on non-binary files.
All of these commands have various switches to change thier behaviour. These can be found in the man pages or by adding -h or –help to the end of a command.
man- brings up the manual for any command eg. man cp. Scoll with page up/down and cursur keys , Press “q” to exit
sudo- (ubuntu and variants) execute a command as another user, defaults to root (administrator)
sudo -s- log in as root and run commands without using sudo. BE CAREFULL when in root, I do not advise staying in root permanently.
passwd- change the password of the current account, pr specified user
top- displays real-time process list of running programs.
ps- like ls but for processes, use ps ax to show all processes on your system not just your own
kill- kill a process, requires a process ID (found with ps or top)
pkillsame as above but use the process name eg. pkill “process name”
apt-get- (ubuntu and variants) allows you to install or remove programs from ubuntu’s repositories
apt-get clean- will remove any cached ‘deb’ files (there will be one for every update or new program installed)
apt-get autoremove- will remove any packages from your system that are no longer required.
reboot- reboots the computer, requires root access – use sudo.
shutdown- shutsdown the computer, requires root access – use sudo. also shutdown -h now- immediate shutdown.

As I mentioned above this is only a small sample, but the ones you are most likely to need and yse regulary.


Subscribe to RSS

  • Tag Cloud

  • Categories

  • Recent Posts

  • Login/Register

Syndicate