Archive for the Linux Category

I would like to transfer from one hosting (Mediatemple) to another (Resellerzoom) (both of them were doing superb job for 2 years btw) but I don’t want to transfer some of the old files. I tried most of tar –exclude combinations I could find on the forums but they did not work. One of them was an answer to a question “Reload this Page tar, excluding directories recursively ” on linuxquestions.

I believe it was due to Mediatemple’s environment which strictly jails you under your account. I tried to exclude with full path initially but it kept getting all the files.

So I decided to use -v (verbose) argument to show the compressed files in the realtime. This way you can capture instantly if you are making a mistake or not. I was initially doing with:

tar -cvf techsoar.tgz --exclude "/full-path/phones/*" --exclude "/full-path/mobiles/*" ./

Which I realized using with “” was a mistake and furthermore not putting an “=” sign between –exclude=… was also wrong.

So finally I could get it working with this line:

tar -cvf techsoar.tgz --exclude=phones/* --exclude=mobiles/* ./

When you are trying to get hardware details for Linux machines, it seems very challenging at first but you have variety options and it is quiet easy. Some includes using custom scripts and existing resource folders(ex: dmesg, /proc) or by some applications like hwinfo and lshw.

In this article we will mention about different methods to get the hardware details from your Linux OS. These tips are mainly for Redhat, Suse and Debian and different distros might include little or more details for the hardware depending on the kernel levels.

1- Hardware Details on Linux using custom script:

This script will get almost everything you would need using existing messages or applications and give you a brief output.

It uses dmesg to get Memory Information
lspci for displaying information about all PCI buses in the system and all devices connected to them. By default, it shows a brief list of devices.
/proc/cpuinfo for CPU information (including cpu model, modelname (AMD Opteron(tm) Processor), Mhz (1992 Mhz)
fdisk -l –> For Hard drive and partition information
rpm -qa for the release info (mainly for Redhat) so you can remove this line for other distros.
/etc/*-release to get the Linux distro
uname -a to get the Linux Kernel level


#!/usr/bin/sh
rm  /tmp/outputecho "/n PCI info /n" >  /tmp/output
lspci >> /tmp/output
echo "/n Memory info /n" >>  /tmp/output /tmp/output
dmesg | grep -i memory >>  /tmp/output
echo "/n CPU info /n" >> /tmp/output
cat /proc/cpuinfo  /n" >>  /tmp/output
echo " HDD info /n" >>  /tmp/output
fdisk -l >>  /tmp/output
echo "/n " >>  /tmp/output
fdisk -l /dev/sdb* >> /tmp/output
echo "/n" >>  /tmp/output
fdisk -l /dev/hda* >> /tmp/output
echo "/n  Package info /n" >>  /tmp/output
rpm -qa >> /tmp/output
echo "/n Relese info /n" >> /tmp/output
cat /etc/*-release >> /tmp/output
echo "/n platform info /n" >> /tmp/output
uname -a >> /tmp/output

2- Hardware Details on Linux using tools (hwinfo, lshw):

There are different tools for different distros that you can use to get the hardware details.

On Suse, you can use: # hwinfo

You could hwinfo for Debians (apt-get hwinfo) very quickly too. It is very handy.
# hwinfo –short will give you a brief summary of your hardware

# hwinfo --short
cpu:
AMD Opteron(tm) Processor 246, 1992 MHz
AMD Opteron(tm) Processor 246, 1992 MHz
monitor:
Generic Monitor
graphics card:
ATI Rage XL
storage:
Floppy disk controller
AMD-8111 IDE
Silicon Image SiI 3114 SATALink Controller
network:
eth2                 Intel EtherExpress PRO/100 S Server Adapter
eth0                 Broadcom NetXtreme BCM5704 Gigabit Ethernet
eth1                 Broadcom NetXtreme BCM5704 Gigabit Ethernet
network interface:
lo                   Loopback network interface
eth0                 Ethernet network interface
eth1                 Ethernet network interface
eth2                 Ethernet network interface

On Debian, you can use: # lshw

# lshw -short will generate a summary output of your hardware list in a organized fashion.

H/W path            Device      Class      Description
======================================================
system     PowerEdge 1950
/0                              bus        0TT740
/0/0                            memory     64KiB BIOS
/0/400                          processor  Intel(R) Xeon(R) CPU           E5405  @ 2.00GHz
/0/400/700                      memory     128KiB L1 cache
/0/400/701                      memory     12MiB L2 cache
/0/400/702                      memory     L3 cache
/0/401                          processor  Intel(R) Xeon(R) CPU           E5405  @ 2.00GHz
/0/401/703                      memory     128KiB L1 cache
/0/401/704                      memory     12MiB L2 cache
/0/401/705                      memory     L3 cache
/0/1000                         memory     8GiB System Memory

3- Hardware Details on Linux using /proc folder:
You can get as many details as you like by just going under /proc folder and showing the contents of files. (# more meminfo)

# more meminfo
MemTotal:      8186420 kB
MemFree:         56572 kB
Buffers:        166008 kB
Cached:        4887080 kB
SwapCached:         12 kB
Active:        2886576 kB
Inactive:      4722968 kB
SwapTotal:     7807580 kB
SwapFree:      7807548 kB
Dirty:             220 kB
Writeback:           0 kB
AnonPages:     2556436 kB
Mapped:          35064 kB
Slab:           453328 kB
SReclaimable:   422408 kB
SUnreclaim:      30920 kB
PageTables:      11848 kB
NFS_Unstable:        0 kB
Bounce:              0 kB
CommitLimit:  11900788 kB
Committed_AS:  4229312 kB
VmallocTotal: 34359738367 kB
VmallocUsed:     27880 kB
VmallocChunk: 34359710403 kB
HugePages_Total:     0
HugePages_Free:      0
HugePages_Rsvd:      0
HugePages_Surp:      0
Hugepagesize:     2048 kB

4- Listing DMI Table with dmidecode and USB devices with lsusb:

Another very effective and powerful tool is # dmidecode. dmidecode is a tool for dumping a computers DMI (some say SMBIOS) table contents in a human-readable format. This table contains a description of the systems hardware components, as well as other useful pieces of information such as serial numbers and BIOS revision.

# lsusb is the tool to show the devices attached to USB port even more.

if you use only # lsusb it will list the ports and what’s attached to it. If you use, lsusb with -v (verbose) you will get tons of info about USB ports.

# lsusb -v

Bus 002 Device 001: ID 0000:0000
Device Descriptor:
bLength                18
bDescriptorType         1
bcdUSB               1.10
bDeviceClass            9 Hub
bDeviceSubClass         0 Unused
bDeviceProtocol         0 Full speed hub
bMaxPacketSize0        64
idVendor           0x0000
idProduct          0x0000
bcdDevice            2.06
iManufacturer           3 Linux 2.6.18.2-34-default ohci_hcd
iProduct                2 OHCI Host Controller
iSerial                 1 0000:03:00.1
bNumConfigurations      1
Configuration Descriptor:
bLength                 9
bDescriptorType         2
wTotalLength           25
bNumInterfaces          1
bConfigurationValue     1
iConfiguration          0
bmAttributes         0xe0
Self Powered
Remote Wakeup
MaxPower                0mA
Interface Descriptor:
bLength                 9
bDescriptorType         4
bInterfaceNumber        0
bAlternateSetting       0
bNumEndpoints           1
bInterfaceClass         9 Hub
bInterfaceSubClass      0 Unused
bInterfaceProtocol      0 Full speed hub
iInterface              0
Endpoint Descriptor:
bLength                 7
bDescriptorType         5
bEndpointAddress     0x81  EP 1 IN
bmAttributes            3
Transfer Type            Interrupt
Synch Type               None
Usage Type               Data
wMaxPacketSize     0x0002  1x 2 bytes
bInterval             255

Ubuntu installations come with 640 x 480 default config on console or TTY (Teleprinter/Teletype/Teletypewriter). To change that config to something readable:

- You need to edit /boot/grub/menu.lst
- To the end there are lines:
title Ubuntu 8.04.2, kernel 2.6.24-23 server
….
….
kernel /vmlinuz-2.6.24-23…

at the end of kernel /vmlinuz line we need to a new argument ‘vga’.

I mostly use vga=791

then update grub using:

# update-grub

and reboot.

Color Depth

640×480

800×600

1024×768

1280×1024

8 (256)

769

771

773

775

15 (32K)

784

787

790

793

16 (65K)

785

788

791

794

24 (16M)

786

789

792

795

Today I was looking for a Linux based, minimalist, web-based managed, and optimized for server distribution to switch my website. All these demands come with different reasons for me but I was not sure whether I can find a solution that will solve all of this at once. I was searching in Engarde Secure Linux distribution

  • SME Server
  • The brilliant idea was modifying Damn Small Linux which is 50 mb. live cd and making it as compact linux webserver. I was planning to use some apt-get and add apache and mysql servers on it.
  • However, I was lucky enough to start testing with
    I start with Live Mode, but could not get the web console at first, then I checked their web page and learnt that I should try with ‘https’. If you happen to start with live mode, do not forget to check
    Default Passwords page. Otherwise you can not login to the system. After I see it on Live mode, I decided to install and see if it is really stable or not.

    In installation mode, you have several server options depending on your needs.
    package selection

    Since I was planning to use it for webserver, I choose webservices. When you choose Web Services, Databases and Mail Services are choosen automatically. Yes, that’s ALL. It starts installing appropriate packages instantly. After installation is completed, you need to reboot. Next time you booted the computer, you can start using Webmin control panel interface from https://ip_address:1023/ Webmin interface touches every point of system, if you don’t feel comfortable with terminal, this is good news.

    As you see, server installation is made easy, you don’t even need to know Linux. Next-next style installation makes everything that simple. I took some screenshots from control panel:
    Services Menu:
    system menu

    System Menu:
    system menu

    One last point I want to mention is the free Update Service. Since security issue is a huge concern for servers, keeping servers up-to-date is one of the crucial problem especially for Linux based servers. Each time there is an update for packages, you have to go through a lot of work to update those packages. This is again made easy by this distro. After I completed installation, checked if there is an update, there was one about CGI libraries and it is done automatically.
    security update service

    To sum up the advantages I’ve seen:

    • Very easy to install and configure
    • Intuitive Webmin based control panel
    • Update service
    • Good documentation

    The features and advantages mentioned on official website:
    EnGarde Secure Linux technical features include:

    • Linux 2.6 kernel for the latest hardware compatibility
    • SELinux Mandatory Access Control provides high security by strictly enforcing service separation at the kernel level
    • Guardian Digital Secure Network features free access to all system and security updates and allows for quick and easy updating of the entire server
    • Broad support for server hardware, including 64-bit AMD architecture and hardware RAID
    • Web-based management of all functions, including the ability to build a complete web presence with FTP, DNS, HTTP, SMTP and more
    • Secure up-to-date LAMP stack serves virtual websites with Apache v2.0, MySQL 5.0, and PHP 4.4 (PHP 5.0 available as an optional package)
    • Latest BIND 9.3 provides secure DNS services
    • Completely new WebTool, featuring easier navigation and greater ability to manage the complete system via a secure web browser connection
    • RSS feed provides ability to display current news and immediate access to system and security updates
    • Integrated firewall with ability to manage individual firewall rules, control port forwarding, and creation of IP blacklists
    • Commercial grade Network Intrusion Detection System displays and graphs incoming attacks in real time
    • Built-in Host IDS monitors system files for unauthorized changes to ensure system integrity
    • Built-in UPS configuration provides ability to manage an entire network of battery-backup devices
    • Real-time access to system and service log information

    To conclude with this distribution is one of the most professional and good engineered distribution I’ve ever seen in OpenSource community.

    Basically, it is a commercial solution which also allows personal usage.