Praji’s Weblog

Welcome to praji’s world

Using Screen for Session Management

leave a comment »

Lost your shell connection? Need multiple shell sessions?

You are logged into your remote server via SSH and happily plucking along at your keyboard and then it happens. Suddenly, the characters stop moving and then you get the dreaded “Connection Closed” message. You have just lost your session. You were halfway through some task and now you have to start over. Ugh. Well you can prevent this from happening by using screen. Screen can not only save you from disconnection disasters, but it also can increase your productivity by using multiple windows within one SSH session.

Use Screen for Session Management!

What is Screen?

As the man page states, “Screen is a full-screen window manager that multiplexes a physical terminal between several processes (typically interactive shells).” This can be a life saver when working on your dedicated server. Screen has a several great features for helping you administer your server more productively and safely. I am going to discuss the three features (multiple windows, logging, sessions) that I use the most but be sure to see the man page for full details.

Installing Screen

Chances are that you already have screen on your system. On most RedHat distributions you can find it in /usr/bin/screen. To see if screen is in your path, you can use the which command:

[admin@ensim admin]$ which screen

If you do not have screen, then you can install it easily from an RPM or the package file for your system. On Cobalt Raq servers, you can safely use the RedHat RPMS appropriate for your system.
Screen RPMs:    rpmfind
Screen Web site: GNU Screen

As you probably already have screen or can use an RPM, I am not going to cover the building of screen from source. Lets get on to how to use screen.

Using Screen

Screen is started from the command line just like any other command:

[admin@gigan admin]$ screen

You may or may not get a text message about screen. If you do not, then you probably think nothing has happened, but it has. You are now inside of a window within screen. This functions just like a normal shell except for a few special characters. Screen uses the command “Ctrl-A” as a signal to send commands to screen instead of the shell. To get help, just use “Ctrl-A” then “?”. You should now have the screen help page.

                Screen key bindings, page 1 of 2.

                Command key:  ^A   Literal ^A:  a

break      ^B b       lockscreen ^X x       reset      Z         
clear      C          log        H          screen     ^C c      
colon      :          login      L          select     " '       
copy       ^[ [       meta       a          silence    _         
detach     ^D d       monitor    M          split      S         
digraph    ^V         next       ^@ ^N sp n suspend    ^Z z      
displays   *          number     N          time       ^T t      
fit        F          only       Q          title      A         
flow       ^F f       other      ^A         vbell      ^G        
focus      ^I         pow_break  B          version    v         
help       ?          pow_detach D          width      W         
history            prev       ^P p ^?    windows    ^W w      
info       i          readbuf    <          wrap       ^R r      
kill       K          redisplay  ^L l       writebuf   >         
lastmsg    ^M m       remove     X          xoff       ^S s      
license    ,          removebuf  =          xon        ^Q q      
                 [Press Space for next page; Return to end.]

Key bindings are the commands the screen accepts after you hit “Ctrl-A”. You can reconfigure these keys to your liking using a .screenrc file, but I just use the defaults.

Multiple Windows

Screen, like many windows managers, can support multiple windows. This is very useful for doing many tasks at the same time without opening new sessions. As a systems manager, I often have four or five SSH sessions going at the same time. In each of the shell, I may be running two or three tasks. Without screen, that would require 15 SSH sessions, logins, windows, etc. With screen, each system gets its own single session and I use screen to manage different tasks on that system.

To open a new window, you just use “Ctrl-A” “c”. This will create a new window for you with your default prompt. For example, I can be running top and then open a new window to do other things. Top stays running! It is still there. To try this for yourself, start up screen and then run top. (Note: I have truncated some screens to save space.)

Start top
Mem:   506028K av,  500596K used,    5432K free,       
0K shrd,   11752K buff
Swap: 1020116K av,   53320K used,  966796K free        
          393660K cached

  PID USER     PRI  NI  SIZE  RSS SHARE STAT %CPU %ME
 6538 root      25   0  1892 1892   596 R    49.1  0.3
 6614 root      16   0  1544 1544   668 S    28.3  0.3
 7198 admin     15   0  1108 1104   828 R     5.6  0.2
Now open a new window with “Ctrl-A” “c”
[admin@ensim admin]$
To get back to top, use “Ctrl-A “n”
Mem:   506028K av,  500588K used,    5440K free,       
0K shrd,   11960K buff
Swap: 1020116K av,   53320K used,  966796K free        
          392220K cached

  PID USER     PRI  NI  SIZE  RSS SHARE STAT %CPU %ME
 6538 root      25   0  1892 1892   596 R    48.3  0.3
 6614 root      15   0  1544 1544   668 S    30.7  0.3

You can create several windows and toggle through them with “Ctrl-A” “n” for the next window or “Ctrl-A” “p” for the previous window. Each process will keep running while your work elsewhere.

Leaving Screen

There are two ways to get out of screen. The first is just like logging out of a shell. You kill the window with “Ctrl-A” “K” or “exit” will work on some systems. This will kill the current windows. If you have other windows, you will drop into one of those. If this is the last window, then you will exit screen.

The second way to leave screen is to detach from a windows. This method leaves the process running and simple closes the window. If you have really long processes, you need to close your SSH program, you can detach from the window using “Ctrl-A” “d”. This will drop you into your shell. All screen windows are still there and you can re-attach to them later.

Attaching to Sessions

So you are using screen now and compiling that program. It is taking forever and suddenly your connection drops. Don’t worry screen will keep the compilation going. Login to your system and use the screen listing tool to see what sessions are running:

[root@gigan root]# screen -ls
There are screens on:
        31619.ttyp2.gigan       (Detached)
        4731.ttyp2.gigan        (Detached)
2 Sockets in /tmp/screens/S-root.

Here you see I have two different screen sessions. To re-attach to a session, use the re-attach command:

[root@gigan root]#screen -r 31619.ttyp2.gigan

Just use screen with the -r flag and the session name. You are now re-attached to the screen. A nice thing about this, is you can re-attach from anywhere. If you are at work or a clients office, you can use screen to start a job and then logout. When you get back to your office or home, you can login and get back to work.

Screen Logging

As a consultant, I find it important to keep track of what I do to someone’s server. Fortunately, screen makes this easy. Using “Ctrl-A” “H”, creates a running log of the session. Screen will keep appending data to the file through multiple sessions. Using the log function is very useful for capturing what you have done, especially if you are making a lot of changes. If something goes awry, you can look back through your logs.

Screen Tips

Just wanted to mention to other cool tricks you can do with screen. Screen can monitor a window for activity or lack thereof. This is great if you are downloading large files, compiling, or watching for output. If you are downloading something or compiling, you can watch for silence. To start the monitor, go to the screen you want to monitor and use “Ctrl-A” “M” to look for activity or “Ctrl-A” “_” to monitor for silence. Then open or switch to a new window. When the monitor detects activity or silence, you will get an alert at the bottom with the window number. To quickly go to that window, use “Ctrl-A” ” (thats a quote mark, ctrl-a then a “). After you do this, just type in the number of the window and enter. To stop monitoring, go to that window and undo the monitor with the same command. For example, to stop monitoring for activity you would use “Ctrl-A” “M” again

Advertisements

Written by praji

July 26, 2008 at 11:06 am

Posted in Uncategorized

Creating Your Own Custom Ubuntu 7.10 Or Linux Mint 4.0 Live-CD With Remastersys

leave a comment »

This guide shows how you can create a Live-CD from your Ubuntu Gutsy Gibbon or Linux Mint 4.0 system with a tool called remastersys.

Remastersys is available in the Linux Mint romeo repository. You can customize your Ubuntu/Linux Mint system and then let remastersys create an iso image of it which you can then burn onto a CD/DVD.

1 Installing Remastersys

Open a terminal and become root:

sudo su

Then add the Linux Mint romeo repository to /etc/apt/sources.list and update the package database:

echo “deb http://www.linuxmint.com/repository romeo/” >>/etc/apt/sources.list
apt-get update

Afterwards you can install remastersys like this:

apt-get install remastersys

Then leave the root shell so that you are logged in as your normal user again:

exit

2 Remastersys Usage

In order to learn how you can use remastersys, run

sudo remastersys

It will then print all available options:

falko@falko-desktop:~$ sudo remastersys
[sudo] password for falko:

Usage of remastersys is as follows:

sudo remastersys backup|clean|dist [cdfs|iso] [filename.iso]


Examples:

sudo remastersys backup (to make a livecd/dvd backup of your system)

sudo remastersys backup custom.iso
(to make a livecd/dvd backup and call the iso custom.iso)

sudo remastersys clean (to clean up temporary files of remastersys)

sudo remastersys dist (to make a distributable livecd/dvd of your system)

sudo remastersys dist cdfs
(to make a distributable livecd/dvd filesystem only)

sudo remastersys dist iso custom.iso
(to make a distributable iso named custom.iso but only
if the cdfs is already present)

cdfs and iso options should only be used if you wish to modify something on the
cd before the iso is created. An example of this would be to modify the isolinux
portion of the livecd/dvd

falko@falko-desktop:~$

3 Creating An ISO Image Of Your Installation

To create an iso image of your installation, simply run

sudo remastersys dist

This will create an iso image called customdist.iso in the /home/remastersys directory. The dist option makes that your personal folder (e.g. /home/falko) will not be included in the iso image. You might have to insert your Ubuntu/Linux Mint installation CD during the process.

This is how the end of the process looks:

[…]
92.16% done, estimate finish Wed Nov 28 15:31:25 2007
93.39% done, estimate finish Wed Nov 28 15:31:25 2007
94.62% done, estimate finish Wed Nov 28 15:31:24 2007
95.85% done, estimate finish Wed Nov 28 15:31:24 2007
97.08% done, estimate finish Wed Nov 28 15:31:25 2007
98.31% done, estimate finish Wed Nov 28 15:31:25 2007
99.54% done, estimate finish Wed Nov 28 15:31:25 2007
Total translation table size: 2048
Total rockridge attributes bytes: 3950
Total directory bytes: 9094
Path table size(bytes): 54
Max brk space used 0
406890 extents written (794 MB)
/home/remastersys/customdist.iso is ready to be burned or tested in a virtual machine.

Check the size and if it is larger than 700MB you will need to burn it to a dvd

796M /home/remastersys/customdist.iso

It is recommended to run ‘sudo remastersys clean’ once you have burned and tested the customdist.iso

falko@falko-desktop:~$

As I’ve just mentioned, the iso image has been created in /home/remastersys:

ls -l /home/remastersys/

falko@falko-desktop:~$ ls -l /home/remastersys/
total 814596
-rw-r–r– 1 root root 73 2007-11-28 15:08 control
-rw-r–r– 1 root root 833310720 2007-11-28 15:31 customdist.iso
drwxr-xr-x 9 root root 4096 2007-11-28 15:07 dummysys
dr-xr-xr-x 5 root root 4096 2007-10-19 02:08 ISOTMP
-rw-r–r– 1 root root 904 2007-11-28 15:06 varexc
falko@falko-desktop:~$

Now you can burn /home/remastersys/customdist.iso onto a CD or DVD (if the iso file is bigger than 700MB, you must use a DVD).

4 Cleaning Up

After you’ve burnt the iso image onto a CD/DVD, you can run

sudo remastersys clean

to remove all temporary file created during the iso generation as well as the /home/remastersys directory.

Written by praji

July 14, 2008 at 12:14 pm

Posted in Uncategorized

Wubi ubuntu installer

leave a comment »

Wubi is an officially supported Ubuntu installer for Windows users that can bring you to the Linux world with a single click. Wubi allows you to install and uninstall Ubuntu as any other Windows application, in a simple and safe way. Are you curious about Linux and Ubuntu? Trying them out has never been easier!

Download Now

Wubi is Simple

No need to burn a CD. Just run the installer, enter a password for the new account, and click “Install”, go grab a coffee, and when you are back, Ubuntu will be ready for you.

Wubi is Safe

You keep Windows as it is, Wubi only adds an extra option to boot into Ubuntu. Wubi does not require you to modify the partitions of your PC, or to use a different bootloader, and does not install special drivers. It works just like any other application. Wubi is spyware and malware free, and being open source, anyone can verify that.

Wubi is Discrete

Wubi keeps most of the files in one folder, and if you do not like it, you can simply uninstall it as any other application.

Wubi is Free

Wubi and Ubuntu cost absolutely nothing (free as in beer), but yet provide a state of the art, fully functional, operating system that does not require any activation and does not impose any restriction on its use (free as in freedom).

Written by praji

July 13, 2008 at 2:00 pm

Posted in Uncategorized

First Ubuntu MID Released

leave a comment »

The Ubuntu development team has released the first version of its Mobile Internet Device (MID) operating system as a developer’s release. Ubuntu 8.04 MID is based on the Ubuntu desktop edition but is built by the Ubuntu Mobile and Embedded community. The MID release is targeted at mobile handsets with limited screen real estate and, in most cases, touch-screen interfaces.Ubuntu MID has a number of reworked applications designed for better use on smaller screens. Among these is the specially-designed MID browser built on the Gecko engine that underpins the Firefox browser. The browser is designed to maximise the window space available on smaller devices as well as including zoom features to make it easier for users.

MID also has the standard essential applications for mobile workers including those for email, calendaring, document reading, contacts and a media player.

Ubuntu MID is available for both Intel’s McCaslin platform used by Samsung’s Q1U and Intel’s Atom processor, also known as Menlow. For users wanting to just try out the platform there is also a KVM (kernel-based virtual machine) edition available as well.

The development team used primarily the Samsung Q1U platform during development while it waited for the Atom platform to become more widely available.

Ubuntu MID will start to follow the normal Ubuntu 6 monthly release cycle with the next version at 8.10.

Ubuntu MID is open source software and can be downloaded from Ubuntu.

– tectonic

ubuntum2po4 First Ubuntu MID Released

“We are delighted to be able to welcome Ubuntu Mobile Internet Device (MID) Edition 8.04 to the world as a full developers’ release. It is based on the Ubuntu Desktop Edition, and it is now available for download.  The Ubuntu MID Edition 8.04 has been built by the Ubuntu Mobile and Embedded community that is sponsored by Canonical and in co-operation with Intel Moblin.org community to take advantage of the Intel(R) Atom Processor, the chipset that is underpinning the Mobile Internet Device (MID) category.  Ubuntu MID Edition will always be an Open Source distribution and is freely available.”

Here is a list of applications appearing in the main menu:

  • Pidgin 2.3.1 (client for several chat protocols)
  • GPE File manager 0.2.5
  • MidBrowser 0.3.0RC1 (similar to Firefox 3.0, web browser)
  • Pimlico Tasks 0.1.3, Dates 0.4.6, Contacts 0.8 (personal organizer)
  • Cheese (taking photos)
  • Moblin Media 0.55-0ubuntu2 (music, photos, videos)
  • Claws Mail 3.3.1
  • Terminal Server Client 0.150 (frontend for rdesktop, vncviewer, wfica, xnest)
  • Neverball
  • Ekiga 2.0.12 (Voice over IP)
  • FBReader (E-book reader)
  • Foobillard
  • Update Manager
  • Neverputt
  • Office Document Reader (converts MS Word, Excel and PowerPoint files to PDF files for Evince)
  • Terminal (uxterm, bash)
  • Frozen Bubble (game)
  • Alarm Clock
  • Galculator 1.3.1
  • Mousepad 0.2.13 (simple text editor)
  • Liferea 1.4.14 (RSS, … feed reader)

Probably the easiest way experience Ubuntu MID Edition is through the KVM image. This a great way to become familiar with the product in readiness for the hardware to be released in the near future by a range of Original Equipment Manufacturers (OEMs) in most markets.

Written by praji

July 12, 2008 at 2:13 pm

Posted in Uncategorized

A Lively World For Google

leave a comment »

Google is launched a virtual world ‘Lively’. The new initiative will pose as Google’s answer to Second Life, where users can indulge in an alter ego life through a user-created avatar.

Google thinks Lively will encourage even more people to dive into alternate realities because it isn’t tethered to one website like Second Life, and it doesn’t cost anything to use. After installing a small packet of software, a user can enter Lively from other websites, like social networking sites and blogs.

http://www.lively.com/html/landing.html

So what are the implications for the future? Well one could argue that, as Google’s main mission is to provide information to web users, we may all, one day, access our information in virtual environments. Will we see the virtual Wikipedia Grand Library where we access user generated information (in a beautifully constructed virtual building) with our avatars and discuss our findings in the Wikipedia Café situated next door? Rather than inputting text into a search engine will we put our questions to a virtual character at the Google Information Centre?

How about the marketing sphere? While wandering around the virtual world could we see animated billboards contain adverts meant directly for you, based on information stored on your avatar?

P.R. businesses may see a shift in how campaigns are delivered. We all know the problems one can have with conference calling, we may one day see journalist interviews take place in a virtual meeting room with avatars representing each party. Product launches taking place in a virtual town hall where all can come and be privy to new information.

Already social networking and blogging are at the forefront of how people receive their daily information, putting a face and a 3d, interactive, world to that is surely just around the corner. Alternate realities? I think Google are being modest, this may soon be reality for us all

Written by praji

July 12, 2008 at 1:30 pm

Posted in Uncategorized

COMPLETE GOOGLE APPS CONFIGURATION

leave a comment »

Create account for  your domain in google Apps
****************************************
First of all, create an account for your domain in google Apps. Please follow the link given below for that.

http://google.com/a/

Changing Mx record for your domain
*****************************************

1. Sign in to your hosting account, and go to the MX record maintenance page.
2. MX records may be located in DNS Management, Mail Server Configuration, or Name Server Management. You may have to enable advanced settings to edit your MX records. Delete all existing MX entries.
3. Enter the following MX records.
You may not be able to enter the priority value exactly as it appears in the table below — if you can’t, make sure each record follows the indicated order. If you aren’t able to assign priorities, you should only enter aspmx.l.google.com.. Set any TTL values to 1 Hour (value=3600).

Priority     Mail Server
1                  ASPMX.L.GOOGLE.COM.
5                  ALT1.ASPMX.L.GOOGLE.COM.

5                     ALT2.ASPMX.L.GOOGLE.COM.

10                      ASPMX2.GOOGLEMAIL.COM.

10                   ASPMX3.GOOGLEMAIL.COM.

Note: ASPMX.L.GOOGLE.COM is the top priority mail server. Don’t assign to any other servers. Learn more about mail server priority. Be sure to include trailing dot (.) at the end of any full-qualified domain names (for example, server.example.com.) if your MX records require this format.

4. Save your changes. Your MX records are now configured to point to Google. Keep in mind that changes to MX records may take up to 48 hours to propagate throughout the Internet.

Adding Cname
*****************

To use the custom URL mail.<domain name> , you must change the CNAME record with your domain host.
Sign in to your domain hosting service.

Navigate to your DNS Management page. The location and name of this page will vary by host, but can generally be found in Domain Management or Advanced Settings.

Find the CNAME settings and enter the following as the CNAME value or alias:

mail

Set the CNAME destination to the following address:

ghs.google.com

Save changes with your domain host and click “I’ve completed these steps” below.

Verifying the accounts
************************
Verify your domain ownership

Google offer two methods of verification. You can either upload an HTML file with a name we specify, or you can change the CNAME record for your domain using the values we specify. Choose your preferred method below.
htmlverification

Once all these steps are done, you can access the webmail interface for your domain using anyone of the methods given below.

http://google.com/a/<domain name>
http://mail.<domain name>

Written by praji

June 28, 2008 at 6:59 am

Posted in Uncategorized

Expanding TLD

with one comment

According to a BBC report, TLD names will be expanded from the typical .com and .org to include any string of letters including Asian, Arabic or other scripts not included in the modern English alphabet.

Domain names, while currently limited to countries (.uk or .us), commerce (.com) and organizations (.net or .org), will be opened to any combination of letters.

Some companies have circumvented TLD name restrictions by manipulating the current system. For instance, Polynesian island Tuvalu leases the use of the .tv address to many television firms.

Starting as soon as 2009, companies will be able to turn brand names into web addresses and individuals their names, however, many businesses, the report said, have pointed out that the new system could be very costly.

Lycos Webhosting’s Marcus Eggensperger told the BBC that  brand owners who will want to protect their trademarks will be be very concerned about the potentially large number of new TLDs. “For a major pharmaceutical business, the cost of registering all of their trademarks when a new trademark is released runs into hundreds of thousands of pounds,” he said.

Icann has assured the public that is has assessed all of the concerns and made the decision with great consideration. “On balance, the board feels that adopting this resolution is in the best interests of the internet and the public at large,” said Icann board member Dennis Jennings.

While many businesses stand to gain or lose, there is anticipation by critics that including multilingual characters will help to further democratize the internet by making it more accessible to those who do not or prefer not to use the English alphabet for communication including Russian President Dmitry Medvedev who called for Russia to be assigned an Internet domain name in the Cyrillic script earlier this month.

Written by praji

June 28, 2008 at 4:43 am

Posted in Uncategorized