Category Archives: Linux

13 books and magazines for linux sysadmins

This is a list of books and magazines i read through the years to learn my job,
there are many other good books as well, but these are my must haves.

1) Magazines:

linux format linux magazin

These two magazines I have been reading for years and they keep getting me fresh ideas and money savers for work,
they have some tutorials for beginners, some more heavy weight material, and fun projects for the free time (ach, whose kidding, what free time…).

although the info in them is usually a little out of date – they are published once a month and the industry is moving so fast, they do have a lot of good ideas in them, and it much more fun to snuggle with a color magazine then sit in front of the screen to read.

2) DNS:

DNS and BIND (5th Edition)

DNS and bind – every Linux sysadmin should know networking as well, and DNS is one of the pillars of the Internet,
even if you are not responsible to a DNS server, if you are working with anything related to the web or networking, you are using DNS, and knowing this subject good will help you solve many networking and web related problems.

3) Sys Admin handbooks:

linux_system unix_system

These are two books from the same authors, both are fantastic easy to use, in depth system administration books,
but you should buy just one out of the two since they very much a like.

so which one to buy? that depends on what flavors of unix/linux you need this info for:
UNIX System Administration Handbook (3rd Edition)
if you have many different unix servers at work you should get the unix book, it covers Solaris 2.7, HP-UX 11.00, Red Hat Linux 6.2, and FreeBSD 3.4.
a little out dated, but still very helpful as it will show you how to do the same thing in the different systems.

Linux Administration Handbook
on the other hand, if you have different linux versions running this book covers redhat, suse and debian – again showing you how to do the same thing in the different flavors.

4) PHP scripting

Different scripting languages are good for different things, PHP is good for building web interfaces for actions you wish your users to do without a shell account on your server.
php allows you to easily build forms and web pages to manipulate files on your server, and changing passwords, restore and backup files, etc…

php_cookbook programming_php

Programming PHP
Is the php book to start with, it takes you through the step of learning a new language and writing easy code.

PHP Cookbook
this php book will give you real world questions and answers for php coding – like how to open and read each word in a local or remote files, working with other web pages etc..

5) PERL scripting

PERL is faster to use when you want to do heavy weight work on databases or files and text manipulation and sorting.

Learning Perl, 5th Edition
The learning perl book will teach you perl from the beginning with real live samples and mind you – perl is tricky.

Programming Perl (3rd Edition)
this is a more in depth book for perl.

6) Bash shell

bash is the most popular shell for the linux environment, its strong and flexible and allows you to do many manipulations from the command line on files and texts, and its a great scripting tool to ease the work of a weary linux sysadmin (or lazy – its a great moto – always write something once).

Learning the bash Shell: Unix Shell Programming

and

bash Cookbook: Solutions and Examples for bash Users

as you can see by now, i really like the combination of a learning book and a cookbook ūüėČ

7) security

hacking_linux_exposed
Hacking Exposed Linux, 3rd Edition

learning what your enemy knows will help you better understand where to look for security holes,
working in this job turns you slowly into a paranoid sysadmin if you wish to continue working, and this book will give you an insight into where likely holes in your servers will be and how to clear them.

8). IT management

practice_system
Practice of System and Network Administration, The (2nd Edition)

Never forget, your not only a linux sysadmin, you are also working in the IT environment and your decision and work is not just linux, you also need to consider network and the other servers and services around you.
this book is about the practice itself, not the technical stuff which we should all learn, and its based on the vast years of experience the authors have.
for example – how to build a support system – the people the software etc,
or how to structure your mail system so you will have place for growth when the company grows.

one of the best books I have read!!!

Technorati Tags: , , ,

disable selinux

The new selinux mechanism provides many security policies through ACL management,
it wil greatly enhance your overall security on your server, and you can read some about it on wikipedia.
but when working on a development server it can slow work down, so sometimes disabling this feature is the best and fast option.
for example when your web server or php script wont delete a file it has full permissions on, this could be caused by selinux.

first check if selinux is enabled:

/usr/sbin/getenforce

will show you the current status for selinux.
the usage for the command is:

/usr/sbin/setenforce –help
usage: /usr/sbin/setenforce [ Enforcing | Permissive | 1 | 0 ]

and to disable it you can either run:

/usr/sbin/setenforce Permissive

or edit this file:
/etc/selinux/config
to set the selinux settings on boot.

Technorati Tags: , ,

proxy settings for the command line

  

When using applications from the command line,
you will sometimes need to setup a specific proxy for them to use, if you don’t have a direct access to the Internet from the server you are working on.

in some of these application you can setup this through the app switches itself, but simpler apps just use the system network settings.

to fix this you can first check what current settings you have now with:

ENV | grep -i proxy

this should show you the current proxy settings you have.

to add your own settings do:

export http_proxy=”http://<proxy-server-ip>:<port>”
export ftp_proxy=”http://<proxy-server-ip>:<port>”

for example:

export http_proxy=”http://192.168.0.10:8080″

after that, just run your command line app, it should pick up and use these settings.

   

 

Technorati Tags: , , ,

Check a web page exists

Here is a short method to check if a web page exists from a perl script,
this script will test the existense of a page and do something as a result:

#!/usr/bin/perl
use LWP::Simple;
print “Content-Type: text/html\n\n”;

$url = “http://site.com/“;

if (head($url)) {
# ok document exists
print “OK: found $url”;
} else {
# something is not well
print “PROBLEM: $url is missing”;
}

This script is using the libwww-perl package.

Technorati Tags: , ,

Check apache from command line

When working with web servers we sometimes need to test them and make sure we are getting what we need to get,
and to see what the web server is sending back including headers.
The simplest and fastest way to do that is through command line.

telnet to the web server port Р(usually port 80) like this:
telnet yonitg.com 80

and then just paste:
GET / HTTP/1.1
Host: yonitg.com

and press “Enter” twice.

Your output should be something like this:

HTTP/1.1 200 OK
Date: Wed, 11 Mar 2009 00:09:53 GMT
Server: Apache/2.2.11 (Win32) DAV/2 mod_ssl/2.2.11 OpenSSL/0.9.8i mod_autoindex_color PHP/5.2.8 mod_perl/2.0.4 Perl/v5.10.0
Last-Modified: Fri, 21 Dec 2007 02:01:16 GMT
ETag: “200000001d649-ca-441c240f37300″
Accept-Ranges: bytes
Content-Length: 202
Content-Type: text/html

these are standard reply headers from the Apache server on my host,
after the headers you will see the rest of the reply from the web server, in my case:

<!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01 Transitional//EN”
http://www.w3.org/TR/html4/loose.dtd“>
<html>
<head>
<title></title>
</head>
<body>
<h1>It works!</h1>
</body>
</html>

This way you don’t need a sniffer installed just to check if the web server is sane.
also from the linux command line you can also test this with:
GET http://yonitg.com
or
POST http://yonitg.com

the GET and POST command line apps are good tools to test http response,
they are part of the libwww-perl package.

Technorati Tags: , ,

Why I love Linux

Hi All,
after many years in the job – Linux System Admin that is,
I’ve decided to start my own spot in the net with a collection of solutions I found to various Linux questions.
starting with Windows NT admin way back then, moving to Linux was scary at the beginning, but with each passing day,
I learned that I love Linux much much more,
especially because you can solve each issue in so many different ways,
i can think of at least 5 ways to create a redirect in the web environment using php, apache, html, or plain simple link in command line. And that’s without giving it a lot of thought.

Well here goes – welcome to my blog, and i hope you find help here!!

Technorati Tags: