| 5 comments ]

Here's a list of commands, tips and info that I've compiled from several different sources. I use this as a quick reference when I need to find info about my computer or my operating system.

General System Info

Note: Most hardware info commands should be run as root. Some even show more info when run as root.

Run qtparted or GParted for hard drive and partition info!!!
Also, see KDiskFree. And fdisk -l for info on all partitions.

hardinfo - good report to run; also, check the Details tab.

Ko's Method For Getting A Hardware Report:
This report runs a series of reports, some of which are listed individually further on in this document.
Install through Synaptic the package installation-report.
Then run in a maximized konsole:
report-hw
or
report-hw > hwreport (Sends the output to a textfile called hwreport in your home folder)

sysinfo a nice graphical display, run it from a terminal.

hal-device-manager
kde-hal-device-manager
These packages can be installed from Synaptic. Use kde-hal-device-manager by clicking KMenu > System > Device Manager.

dmidecode -t memory (as root) The dmidecode tool dumps your system’s DMI (Desktop Management Interface) table contents in a human-readable format. This table contains information regarding system’s hardware components, as well as BIOS revisions etc. dmidecode output not only describes system current configuration, but also reports the BIOS limitations on supported CPU speed, Maximum Memory allowed and more.
dmidecode | less (as root) BIOS info and system info (space to page down, q to quit)

uname -a (info on your server)
uname -m machine number (i.e. - i686)
uname -r kernel version

lshw (as root) - list hardware; might want to run lshw | less (space to page-down, q to quit)
lshw-gtk (as root) - download this from Synaptic; it can be started from the terminal; click on any item for info; double click on the the items in bold to drill down; excellent front-end for lshw.

lsb_release -a (release info) (don't forget the underscore) (or see /etc/lsb_release)
***In Mepis Linux 6.5, this command returns:
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 6.06.1 LTS
Release: 6.06
Codename: dapper

In Mepis 6.5, one solution for finding the version that you're running is to go to take a look at the login screen.

lspci (as root) (controllers, etc.) (VERY good report; -v is verbose, -vv is very verbose
lspci -tv (as root) shows tree
lsusb, lsusb -tv - list usb devices
lsmod (at root, shows kernel modules currently loaded. Also try lsmod | less)

/proc - there's important info located in this directory! cd /proc, then ls; use cat to read the files in /proc such as cpuinfo, devices, filesystems, meminfo, partitions, swaps, uptime, version, etc.; also, you can cd into the subdirectories in /proc, for example cd driver.
Examples:
cat /proc/cpuinfo (or cat cpuinfo from inside /proc)
cat /proc/version (or cat verson from inside /proc) - version info
cat /proc/swaps (or cat swaps from inside /proc) will show info on each swap partition.

top - display Linux tasks, real-time; system summary info and a list of tasks currently being managed by the kernel - includes a live report on swap being used; type Shift-f to get sort options while running (default sort is k - CPU usage)

htop - even better than top; interactive process viewer can be used to kill processes.

ctrl-esc (from anywhere in KDE) - brings up the ProcessTable

procinfo – procinfo is a small program that gathers some system information from diverse files under /proc and prints it to the screen. It duplicates some of the functionality of free(1) and uptime(1). This also includes lsdev for displaying information about installed hardware and socklist for displaying a list of open sockets.

Other Ways To List Processes:
ps aux
ps -e

swapon -s shows swap partitions and info
swapon -a makes all swap partitions available as indicated in /etc/fstab.

fdisk -l gives all partition info on hard disk(s).

/etc/fstab (the fstab file contains file system configuration information)

free (memory usage, in kilobytes.
free -m (memory usage, in MB).

ksysguard application and ksysguard tray applet both show memory usage

df -h (disk info about all mounted file systems, human-readable)
df -hT (disk info about all mounted file systems, human-readable, showing file system type)

du / -bh | more detailed diskusage for each subdirectory starting at root, human readable; use space to page down, q to quit.
du -s /var/log/* - displays space usage of all the files in /var/log

hdparm -t /dev/hda (as root) - display disk performance of hda

This shows what the cpu identifies itself as:
arch (but it could be wrong, see command below)
rpm --showrc| grep " arch" (if rpm is installed)

ifconfig -a – displays IP address and other info

Time Info Commands:
date
uptime


Package Info

apt-show-versions > InstalledPkgs (as root) - outputs the text file InstalledPkgs to your home directory. This shows all packages on your system. This list won't be alphabetized. You can copy and paste it into a spreadsheet and then sort it. You can download apt-show-versions with Synaptic. See man apt-show-versions for more info. Another option is to look at the installed packages in Synaptic.

ls /var/cache/apt/archives > AddedPkgs outputs the text file AddedPkgs to your home directory. This shows all of the packages that you've added to your system (unless you've deleted this info, or unless Synaptic has been set to delete it!). There's also a "partial" directory, so
ls /var/cache/apt/archives/partial > PartialPkgs to output a text file called PartialPkgs.

To get a package list sorted by size:
dpkg-query -W --showformat='${Installed-Size} ${Package}\n' | sort -n


Here's a section that I tacked on, just so I'd have a quick reference to some helpful bash commands.

Bash Info

echo $PATH show the content of the environmental variable named PATH
echo $? shows the exit code of the last command

help shows a list of shell builtin commands, and help name shows help on the command name; also, see the section on Shell Builtin Commands in man bash

whereis locates the binary, source, and manual page files for a command.

which returns the pathnames of the files which would be executed in the current environment, had its arguments been given as commands in a strictly POSIX-conformant shell. It does this by searching the PATH for executable files matching the names of the arguments. Note: In Mepis Linux, which is an alias for type -path. Although that command is not explicitly defined, try the command help type for more info on the type command. which=type -path may be the same as type -P. In practice, the which command and the type -path command may be equivalent. To see the true which command in action in Mepis Linux, type "which" (use quotes) (or unalias which to permanently remove the alias).

type (name) indicates how it would be interpreted if used as a command name

alias shows a list of all aliases
unalias will remove an alias permanently
"command" quoting the command will run the "true" command (if it exists) instead of the alias

file guesses what type of file
file file
file -i file for more info
file -iz file for compressed files
file -s file for block or special character files

tree – list directory structure and content in a tree-like format; by default lists the contents of the directory that you're in.

cal - current month
cal -3 - last month, current month, and next month
cal [month] year - specify month, or month and year [examples: cal august 2007; cal 2006]


NOTE: This is a Guest Article on the ComputerBob.com Web site. Guest Articles contain reviews, opinions, tips, and other material written by guest authors. Articles may be submitted for possible publication to the email address listed on the Contact page (a Contact link appears at the bottom of every article). ComputerBob edits all submitted articles before publishing them. By submitting an article to ComputerBob, the submitter implicitly grants ComputerBob the right to edit it and to publish it as a Guest Article on the ComputerBob.com web site. Guest Articles reflect the views of their authors only. ComputerBob is not responsible for the accuracy or reliability of Guest Articles.

Refer to http://www.computerbob.com

| 13 comments ]

GNU/Linux

RedHat Certified Engineer (RHCE)


Lesson 01 - UNIX History

Lesson 02 - GNU/Linux Introduction

Lesson 03 - GNU/Linux Concepts

Lesson 04 - Difference between Fedora and RedHat Enterprise Linux

Lesson 05 - Major GNU/Linux Distributions

Lesson 06 - GNU/Linux Kernel and Shell

Lesson 07 - GNU/Linux File System

Lesson 08 - What is inode number?

Lesson 09 - GNU/Linux File System Hierarchy

Lesson 10 - GRUB (GNU GRand Unified Boot loader)

Lesson 11 - Working with grub.conf configuration file

Lesson 12 - How to password protect GRUB (GNU GRand Unified Boot loader)

Lesson 13 - Linux Rescue Mode (Linux Rescue Environment)

Lesson 14 - init process and Linux runlevels

Lesson 15 - inittab configuration file

Lesson 16 - Working with inittab configuration file

Lesson 17 - inittab format

Lesson 18 - Creating and editing text files using vi editor

Lesson 19 - Linux File System Management Tools - fdisk command

Lesson 20 - Linux File System Management Tools - mkfs, mkfs.ext2, mkfs.ext3 commands

Lesson 21 - What is file system journaling?

Lesson 22 - Linux File System Management Tools - fsck command

Lesson 23 - Introduction to Linux /etc/fstab file

Lesson 24 - Linux mount and umount commands

Lesson 25 - Linux mount options

Lesson 26 - Introduction to Bourne Again Shell (BASH)

Lesson 27 - Basic Linux commands

Lesson 28 - Introduction to Logical Volume Manager (LVM)

Lesson 29 - How to create and manage Logical Volume Manager (LVM)

Lesson 30 - Introduction to Redundant Array of inexpensive (or Independent) Disks (RAID)

Lesson 31 - How to create and manage Redundant Array of Inexpensive Disks (RAID)

Lesson 32 - Introduction to swap space

Lesson 33 - How to create and manage swap space

Lesson 34 - Introduction to Linux user administration

Lesson 35 - How to add a user in Linux using useradd command

Lesson 36 - How to use passwd command to manage user passwords

Lesson 37 - How to modify a Linux user using usermod command

Lesson 38 - How to set Linux password aging using chage command

Lesson 39 - How to remove user from Linux using userdel command

Lesson 40 - The Linux user database (/etc/passwd)

Lesson 41 - The Linux password database (/etc/shadow)

Lesson 42 - Introduction to Linux User Group

Lesson 43 - How to create a new group in Linux using groupadd command

Lesson 44 - Linux Group Database (/etc/group) file

Lesson 45 - How to manage Linux user group

Lesson 46 - The Linux File Permissions

Lesson 47 - How to use chmod command to change Linux file permissions

Lesson 48 - How to use chgrp command to change Linux group ownership of a file

Lesson 49 - How to use chown command to change linux user ownership of a file

Lesson 50 - Linux setuid and setgid

Lesson 51 - What is Linux umask?

Lesson 52 - What is Security-enhanced Linux (SELinux), Discretionary Access Control (DAC), Mandatory Access Control (MAC) and Role-based Access Control (RBAC)?

Lesson 53 - Security-enhanced Linux (SELinux) Security Contexts

Lesson 54 - How Security-enhanced Linux (SELinux) works

Lesson 55 - Security-enhanced Linux (SELinux) configuration-file (/etc/selinux/conf)

Lesson 56 - Security-enhanced Linux (SELinux) - Filesystem Relabeling

Lesson 57 - Important Security-enhanced Linux (SELinux) commands

Lesson 58 - Introduction to Linux Disk Quota

Lesson 59 - How to create Linux disk quota database files (aquota.group and aquota.user) using quotacheck command

Lesson 60 - How to turn on and turn off Linux disk quota using quotaon and quotaoff commands

Lesson 61 - How to manage Linux disk quota using edquota and repquota commands

Lesson 62 - Introduction to scheduling tasks using Linux cron daemon

Lesson 63 - How to schedule a task using Linux crontab (/etc/crontab) file

Lesson 64 - How to schedule tasks using Linux at command

Lesson 65 - Linux File filter commands sort wc and grep

Lesson 66 - How to compress, uncompress and view files using Linux commands gzip, gunzip and zcat

Lesson 67 - How to compress uncompress view files using Linux commands bzip2 bunzip2 and bzcat

Lesson 68 - How to use Linux tar (tape archive) command to create archives

Lesson 69 - Introduction to RedHat Package Manager (RPM)

Lesson 70 - Introduction to YUM (Yellow dog Updater, Modified) Package Manager

Lesson 71 - Common Linux network tools - ping, telnet, netstat and arp

Lesson 72 - Linux xinetd Super Server daemon

Lesson 73 - Linux Network Interface Configuration tool - ifconfig

Lesson 74 - Important Linux network configuration files

Lesson 75 - How to configure Dynamic Host Configuration (DHCP) Protocol in Linux

Lesson 76 - Introduction to Domain Name System (DNS)

Lesson 77 - Linux Domain Name System (DNS) client configuration files /etc/hosts, /etc/nsswitch.conf and /etc/resolv.conf

Lesson 78 - Berkeley Internet Name Domain (BIND) as a DNS server

Lesson 79 - How to configure caching-only name server

Lesson 80 - BIND configuration file (/etc/named.conf)

Lesson 81 - Domain Name System (DNS) zone files

Lesson 82 - RNDC (Remote Name Daemon Control)

Lesson 83 - Introduction to Secure Shell and OpenSSH

Lesson 84 - Important OpenSSH client tools - scp, sftp, ssh, ssh-keygen, ssh-copy-id, slogin

Lesson 85 - OpenSSH Configuration Files

Lesson 86 - How to mount a remote File System using Network File System (NFS)

Lesson 87 - How to configure Very Secure File Transfer Protocol Daemon (vsFTPd)

Lesson 88 - Introduction to Network Time Protocol (NTP)

Refer to http://www.omnisecu.com

| 4 comments ]

Objective of OpenSourceNuts.com

It is not always easy, but my objective is to provide step-by-step tutorial to configure your Linux server.

All the posts/articles available will be related to CentOS. Articles which are not related to Linux are covered under Articles.

RHCE/CentOS

Index

This Tutorial is divided into sections, which are further divided into sub-sections.

http://www.opensourcenuts.com

| 2 comments ]

Trong các bài viết trước, mình đã trình bày cách cài đặt MySQL Server trên CentOS. Nhưng để quản lý cơ sỡ dữ liệu trên MySQL Server một cách dễ dàng hơn thì chúng ta cần phải có công cụ quản lý. Một trong những công cụ quản lý, thao tác cơ sỡ dữ liệu của MySQL được dùng khá phổ biến hiện nay là phpMyAdmin.

Trong bài viết này, mình sẽ trình bày cách cài đặt phpMyAdmin trên CentOS 5.6.

Yêu cầu: Đã cài đặt MySQL

Tiến hành:

Chúng ta sẽ sử dụng lệnh yum để tải và cài đặt gói phpmyadmin.

1
yum install phpmyadmin

Lưu ý: Nếu bạn gõ lệnh trên mà thấy xuất hiện thông báo "No package phpmyadmin available", thì bạn cần cập nhật lại gói yum của mình. Vào http://rpmrepo.org/RPMforge/Using và tải về phiên bản phù hợp với bản CentOS hiện tại của bạn.

Ví dụ ở đây mình tải bản cho x64:

http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el5.rf.x86_64.rpm

Sau đó cài đặt gói này

1
rpm -Uhv rpmforge-release-0.5.1-1.el5.rf.x86_64.rpm

Đánh lệnh cập nhật lại yum của CentOS

1
yum update

Sau khi đã cập nhật xong thì bạn có thể sử dụng yum install phpmyadmin để cài đặt rồi.

Cấu hình phpMyAdmin:

- Để có thể truy cập từ xa bằng các browser của máy client. Chúng ta cần sửa lại nội dung của file phpmyadmin.conf

Đánh lệnh:

1
vi /etc/httpd/conf.d/phpmyadmin.conf

Bạn sẽ thấy nội dung như sau:

1
2
3
4
5
6
7
8
9
"/usr/share/phpmyadmin">
Order Deny,Allow
Deny from all
Allow from 127.0.0.1
</Directory>

Ở dòng "Allow from 127.0.0.1" bạn điền vào các ip của các máy client có thể truy cập vào phpMyAdmin. Hoặc bạn cũng có thể mở cho tất cả các client đều được phép truy cập bằng cách sửa lại là "Allow from all"

Sau đó, chúng ta cần khởi động lại Apache:

1
service httpd restart

Bây giờ, bạn có thể truy cập vào phpMyAdmin bằng địa chỉ http://IP_Server_or_Domain/phpmyadmin.

Tuy nhiên có thể bạn sẽ gặp lỗi như sau:

1
2
Error
The configuration file now needs a secret passphrase (blowfish_secret).

Bạn cần sửa lại file config.inc.php:

1
vi /usr/share/phpmyadmin/config.inc.php

Tìm dòng:

1
$cfg['blowfish_secret'] = ''; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! */</em>

Trong dấu '' bạn đánh vào 1 sceret keyword bất kì và lưu file này lại.

Và bây giờ, ta có thể đăng nhập vào phpMyAdmin thành công!

Duy Khánh (http://Khanh.Com.Vn)

| 1 comments ]

Trên màn hình Console nhập lệnh để cài đặt

1
yum install mysql-server

Chọn Yes (y) trong quá trình cài đặt nếu được yêu cầu.

Màng hình báo cài đặt thành công

Sau khi cài đặt thành công, ta tiến hành start mysql server lên

1
service mysqld start

Để đổi mật khẩu của tài khoản Root quản trị Mysql server

1
/usr/bin/mysqladmin -u root password ‘new-password’

hoặc

1
/usr/bin/mysqladmin -u root -h khanh.com.vn password ‘new-password’

(với -h là host name)

Sau này, nếu muốn đăng nhập vào mysql thì dùng lệnh:

1
$ mysql --user=root -p

sau đó nhập password vào

Cấu hình để MySQl Server khởi động mỗi khi khởi động lại Server

http://Khanh.com.vn

| 1 comments ]

1. Cài đặt Apache

Dùng lệnh để tải gói và cài đặt.

1
yum install httpd

Cấu hình Apache khởi động cùng với Server.

Sau đó khởi động Apache:

1
service httpd start

Test thử quá trình cài đặt đã thành công hay chưa. Vào trình duyệt gõ http://localhost

Trên CentOs, thư mục lưu trữ web mặc định của Apache được lưu ở đường dẫn /var/www/html và tệp tin cấu hình được lưu tại /etc/httpd/conf/httpd.conf. Các file cấu hình khác được lưu tại thư mục /etc/httpd/conf.d/


2. Cài đặt PHP:

Cài đặt php bằng lệnh

1
yum install php

Sau đó ta khởi động lại Apache

1
service httpd restart

Test xen quá trình cài module PHP đã thành công hay chưa, ta tạo 1 file info.php chứa trong /var/www/html với nội dung như sau:

1
2
3
phpinfo();
?>

Mở trình duyệt và truy cập vào link http://localhost/info.php sẽ thấy kết quả như hình:

Hỗ trợ MySQL cho PHP5

Trước tiên bạn cần cài đặt MySQL trước, bạn có thể xem cách cài đặt MySQL Server trên CentOS tại đây

Để hỗ trợ MySQL cho PHP5, ta cần cài đặt thêm gói php-mysql

Đánh lệnh sau để tìm các gói cần thiết

1
yum search php

Ở đây mình cài các gói sau:

1
yum install php-mysql php-gd php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc

Sau khi cài xong, ta tiến hành khởi động lại Apache

1
service httpd restart

Truy cập vào lại link http://localhost/info.php ta sẽ thấy kết quả như hình sau

Quá trình cài đặt như vậy là thành công, trong bài viết sau mình sẽ hướng dẫn cách cài đặt và cấu hình phpMyAdmin trên CentOS :).

Duy Khánh (http://Khanh.Com.Vn)

| 1 comments ]

Red Hat Linux 7 Unleashed

Red Hat Linux 7 Unleashed

By

More Information

Red Hat Linux 7 Unleashed shows you how to install, configure, and manage version 7, the latest version of Red Hat operating system. Version 7 boasts the latest stable Linux kernel, a new and improved installation program, updated libraries and a host ...

Table of Contents