Thursday, December 9, 2010

Fedora Package Database

The Package Database is a central repository of package information in Fedora. You will eventually be able to find and change all the metainformation about a package by searching the database. The current implementation is focused on the data that package developers and release engineers need to create packages and spin them into a distribution.


The Link is: 

https://admin.fedoraproject.org/pkgdb

Monday, December 6, 2010

Installing Oracle Database 10g Release 2 on Linux

 Download Oracle Database Software from this web site 

http://www.oracle.com/technetwork/database/enterprise-edition/downloads/index.html

 

Part I: Installing Linux

This guide assumes a server with the following hardware:
  • 800MHz Pentium III CPU
  • 1024MB of RAM
  • SCSI host adapter (Ultra SCSI 160)
  • Four SCSI disk drives (1 x 9GB + 3 x 36GB)
  • One 100Base-T Ethernet adapter
Your hardware does not have to match this in order to use this guide.  All that is necessary for a basic database install is a single CPU, 1024MB of RAM, and one disk drive (IDE, SCSI, or FireWire) with at least 7GB of free space.
Now, let's walk through the process of installing the Linux operating system on a server. The instructions assume a fresh install of Linux (as opposed to an upgrade), that the server will be dedicated to Oracle, and that no other operating systems or data are on the server. 

Oracle Database 10g Release 2 is certified to run the base release of RHEL4 (Advanced Server and Enterprise Server) without updates. If you have update CDs, you can use the boot CD from the update instead of the boot CD from the base release to automatically apply all updates during the installation. All updates from Red Hat are supported by Oracle.
The easiest and fastest way to apply the updates for a fresh install of Linux is to perform the install by using the update CDs. If Linux is already installed or you don't have the updates on CDs, they can be applied through RHN. Because this guide is designed for a fresh Linux install, you'll use the update CDs.
  1. Boot the server using the first CD.
    • You may need to change your BIOS settings to allow booting from the CD.
  2. The boot screen appears with the boot: prompt at the bottom of the screen.
    • Select Enter to continue with a graphical install on the console. (For other installation methods and options, refer to the Red Hat Installation Guide.)
    • The installer scans your hardware, briefly displays the Red Hat splash screen, and then begins a series of screen prompts.
  3. Language Selection
    • Accept the default.
  4. Keyboard Configuration
    • Accept the default.
  5. Welcome Screen
    • Click on Next.
  6. Disk Partitioning Setup
    • A thorough treatment of disk partitioning is beyond the scope of this guide, which assumes that you are familiar with disk partitioning methods. (WARNING: Improperly partitioning a disk is one of the surest and fastest ways to wipe out everything on your hard disk. If you are unsure how to proceed, stop and get help, or you will risk losing data!)
      This guide uses the following partitioning scheme, with ext3 for each filesystem:

      The 9GB disk on the first controller (/dev/sda) will hold all Linux and Oracle software and contains the following partitions:
      - 100MB /boot partition
      -1,500MB swap partition—Set this to at least twice the amount of RAM in the system but to no more than 2GB. (Thirty-two-bit systems do not support swap files larger than 2GB.) If you need more than 2GB of swap space, create multiple swap partitions.
      -7,150MB root partition—This partition will be used for everything, including /usr, /tmp, /var, /opt, /home, and more. This approach is purely to simplify installation for the purposes of this guide. A more robust partitioning scheme would separate these directories onto separate filesystems.
  7. Boot Loader Configuration
    • Accept the default.
  8. Network Configuration
    • It is usually best to configure database servers with a static IP address. To do so, click on Edit .
    • A pop-up window appears. Uncheck the Configure using DHCP box, and enter the IP Address and Netmask for the server. Be sure that Activate on boot is checked, and click on OK .
    • In the Hostname box, select manually and enter the hostname.
    • In the Miscellaneous Settings box, enter the remaining network settings.
  9. Firewall Configuration
    • For the purposes of this walk-through, no firewall is configured. Select No firewall
    • Select Disabled on the "Enable SELinux" drop down list. 
    • Click on Proceed when the "Warning - No Firewall" window appears.
  10. Additional Language Support
    • Accept the default.
  11. Time Zone Selection
    • Choose the time settings that are appropriate for your area. Setting the system clock to UTC is usually a good practice for servers. To do so, click on System clock uses UTC.
  12. Set Root Password
    • Enter a password for root, and enter it again to confirm.
  13. Package Installation Defaults
    • Select Customize software packages to be installed.
  14. Package Group Selection
    • Select only the package sets shown here and leave all others unselected. 
    • Desktop
      • X Window System
      • Gnome
    • Applications
      • Graphical Internet (optional)
    • Servers
      • Do not select anything in this group.
    • Development
      • Development Tools
    • System
      • Administration Tools
      • System Tools
        • Add the package 'sysstat' by clicking on the Details link and selecting "sysstat - The sar an iostat system monitoring commands." from the Optional Packages list.
    • Miscellaneous
      • Do not select anything in this group.
    • Click on Next to proceed.
  15. Installing Packages
    • Software will be copied to the hard disk and installed. Change disks as prompted.
  16. Congratulations
    • Remove the installation media from the system, and click on Reboot .
  17. The system automatically reboots and presents a new welcome screen.
    • Click on Next.
  18. License Agreement
    • Read the license agreement. If you agree to the terms, select Yes, I agree to the License Agreement and click on Next.
  19. Date and Time
    • Set the Date and Time.
    • If you want to use an NTP server (recommended), select Enable Network Time Protocol and enter the name of the NTP server.
  20. Display
    • Accept the defaults or change as required.
  21. Red Hat Login
    • Enter your Red Hat Network login and password or create a new one.
  22. System User
    • Create an account for yourself.
    • Do not create an account for oracle at this time. Creating the oracle account is covered later in this section.
  23. Additional CDs
    • Click on Next.
  24. Finish Setup
    • Click on Next.
  25. A graphical login screen appears.
  26. Congratulations! Your RHEL4 software is now installed.
Verifying Your Installation
Required kernel version: 2.6.9-5.0.5.EL  This kernel, or any of the kernels supplied in updates, works with Oracle Database 10g Release 2 .
Check your kernel version by running the following command:
uname -r

Ex:
# uname -r
2.6.9-22.ELsmp
Once you've completed the steps above, all of the packages required for Oracle Database 10g Release 2 will have been installed.  Verify this using the example below.
Required package versions (or later):
  • binutils-2.15.92.0.2-10.EL4
  • compat-db-4.1.25-9
  • control-center-2.8.0-12
  • gcc-3.4.3-9.EL4
  • gcc-c++-3.4.3-9.EL4
  • glibc-2.3.4-2
  • glibc-common-2.3.4-2
  • gnome-libs-1.4.1.2.90-44.1
  • libstdc++-3.4.3-9.EL4
  • libstdc++-devel-3.4.3-9.EL4
  • make-3.80-5
  • pdksh-5.2.14-30
  • sysstat-5.0.5-1
  • xscreensaver-4.18-5.rhel4.2
  • libaio-0.3.96
  • openmotif21-2.1.30-11.RHEL4.2  (Required only to install Oracle demos.  Installation of Oracle demos is not covered by this guide.)
To see which versions of these packages are installed on your system, run the following command:
rpm -q binutils compat-db control-center gcc gcc-c++ glibc glibc-common \
gnome-libs libstdc++ libstdc++-devel make pdksh sysstat xscreensaver libaio openmotif21
Ex: 
# rpm -q binutils compat-db control-center gcc gcc-c++ glibc glibc-common \
> gnome-libs libstdc++ libstdc++-devel make pdksh sysstat xscreensaver libaio openmotif21
binutils-2.15.92.0.2-15
compat-db-4.1.25-9
control-center-2.8.0-12.rhel4.2
gcc-3.4.4-2
gcc-c++-3.4.4-2
glibc-2.3.4-2.13
glibc-common-2.3.4-2.13
gnome-libs-1.4.1.2.90-44.1
libstdc++-3.4.4-2
libstdc++-devel-3.4.4-2
make-3.80-5
pdksh-5.2.14-30.3
sysstat-5.0.5-1
xscreensaver-4.18-5.rhel4.9
libaio-0.3.103-3
openmotif21-2.1.30-11.RHEL4.4



Part II: Configuring Linux for Oracle
 
Now that the Linux software is installed, you need to configure it for Oracle. This section walks through the steps required to configure Linux for Oracle Database 10g Release 2.
Verifying System Requirements
To verify that your system meets the minimum requirements for an Oracle Database 10g Release 2 database, log in as root and run the commands below.
To check the amount of RAM and swap space available, run this:
grep MemTotal /proc/meminfo
grep SwapTotal /proc/meminfo

Ex:
# grep MemTotal /proc/meminfo
MemTotal: 1034680 kB
# grep SwapTotal /proc/meminfo
SwapTotal: 1534196 kB
The minimum RAM required is 1024MB, and the minimum required swap space is 1GB. Swap space should be twice the amount of RAM for systems with 2GB of RAM or less and between one and two times the amount of RAM for systems with more than 2GB.
You also need 2.5GB of available disk space for the Oracle Database 10g Release 2 software and another 1.2GB for the database. The /tmp directory needs at least 400MB of free space. To check the available disk space on your system, run the following command:
df -h

Ex:
# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda3 6.8G 1.3G 5.2G 20% /
/dev/sda1 99M 17M 77M 18% /boot
The example shows that the /tmp directory does not have its own filesystem. (It's part of the root filesystem for this guide.) With 5.2 GB available, the root filesystem has just enough space for the installation (2.5 + 1.2 + 0.4 = 4.1GB) with a little room left over.
Create the Oracle Groups and User Account
Next, create the Linux groups and user account that will be used to install and maintain the Oracle Database 10g Release 2 software. The user account will be called oracle, and the groups will be oinstall and dba. Execute the following commands as root:
/usr/sbin/groupadd oinstall
/usr/sbin/groupadd dba
/usr/sbin/useradd -m -g oinstall -G dba oracle
id oracle

Ex:
# /usr/sbin/groupadd oinstall
# /usr/sbin/groupadd dba
# /usr/sbin/useradd -m -g oinstall -G dba oracle
# id oracle
uid=501(oracle) gid=502(oinstall) groups=502(oinstall),503(dba)
Set the password on the oracle account:
passwd oracle

Ex:
# passwd oracle
Changing password for user oracle.
New password:
Retype new password:
passwd: all authentication tokens updated successfully.
Create Directories
Now create directories to store the Oracle Database 10g Release 2 software and the database files. This guide adheres to the Optimal Flexible Architecture (OFA) for the naming conventions used in creating the directory structure. For more information on OFA standards, see Appendix C of the Oracle Database Installation Guide 10g Release 2 (10.2) for Linux x86.
The following assumes that the directories are being created in the root filesystem. This is done for the sake of simplicity and is not recommended as a general practice. These directories would normally be created as separate filesystems.
Issue the following commands as root:
mkdir -p /u01/app/oracle
chown -R oracle:oinstall /u01/app/oracle
chmod -R 775 /u01/app/oracle

Ex:
# mkdir -p /u01/app/oracle
# chown -R oracle:oinstall /u01/app/oracle
# chmod -R 775 /u01/app/oracle
Configuring the Linux Kernel Parameters
The Linux kernel is a wonderful thing. Unlike most other *NIX systems, Linux allows modification of most kernel parameters while the system is up and running. There's no need to reboot the system after making kernel parameter changes. Oracle Database 10g Release 2 requires the kernel parameter settings shown below. The values given are minimums, so if your system uses a larger value, don't change it.
kernel.shmall = 2097152
kernel.shmmax = 536870912
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
fs.file-max = 65536
net.ipv4.ip_local_port_range = 1024 65000
net.core.rmem_default=262144
net.core.wmem_default=262144
net.core.rmem_max=262144
net.core.wmem_max=262144
If you're following along and have just installed Linux, the kernel parameters will all be at their default values and you can just cut and paste the following commands while logged in as root.
cat >> /etc/sysctl.conf <<EOF
kernel.shmall = 2097152
kernel.shmmax = 536870912
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
fs.file-max = 65536
net.ipv4.ip_local_port_range = 1024 65000
net.core.rmem_default=262144
net.core.wmem_default=262144
net.core.rmem_max=262144
net.core.wmem_max=262144
EOF
/sbin/sysctl -p

Ex:
# cat >> /etc/sysctl.conf <<EOF
> kernel.shmall = 2097152
> kernel.shmmax = 536870912
> kernel.shmmni = 4096
> kernel.sem = 250 32000 100 128
> fs.file-max = 65536
> net.ipv4.ip_local_port_range = 1024 65000
> EOF
# /sbin/sysctl -p
net.ipv4.ip_forward = 0
net.ipv4.conf.default.rp_filter = 1
net.ipv4.conf.default.accept_source_route = 0
kernel.sysrq = 0
kernel.core_uses_pid = 1
kernel.shmall = 2097152
kernel.shmmax = 536870912
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
fs.file-max = 65536
net.ipv4.ip_local_port_range = 1024 65000
net.core.rmem_default = 262144
net.core.wmem_default = 262144
net.core.rmem_max = 262144
net.core.wmem_max = 262144
Run the following commands as root to verify your settings:
/sbin/sysctl -a | grep shm
/sbin/sysctl -a | grep sem
/sbin/sysctl -a | grep file-max
/sbin/sysctl -a | grep ip_local_port_range
/sbin/sysctl -a | grep rmem_default/sbin/sysctl -a | grep rmem_max/sbin/sysctl -a | grep wmem_default/sbin/sysctl -a | grep wmem_max

Ex:
# /sbin/sysctl -a | grep shm
kernel.shmmni = 4096
kernel.shmall = 2097152
kernel.shmmax = 536870912
kernel.shm-use-bigpages = 0
# /sbin/sysctl -a | grep sem
kernel.sem = 250 32000 100 128
# /sbin/sysctl -a | grep file-max
fs.file-max = 65536
# /sbin/sysctl -a | grep ip_local_port_range
net.ipv4.ip_local_port_range = 1024 65000
# /sbin/sysctl -a | grep rmem_default
net.core.rmem_default = 262144
# /sbin/sysctl -a | grep rmem_max
net.core.rmem_max = 262144
# /sbin/sysctl -a | grep wmem_default
net.core.wmem_default = 262144
# /sbin/sysctl -a | grep wmem_max
net.core.wmem_max = 262144
For Novell SUSE Linux releases, use the following to ensure that the system reads the /etc/sysctl.conf file at boot time:
/sbin/chkconfig boot.sysctl on
Setting Shell Limits for the oracle User
Oracle recommends setting limits on the number of processes and open files each Linux account may use. To make these changes, cut and paste the following commands as root:
cat >> /etc/security/limits.conf <<EOF
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
EOF

cat >> /etc/pam.d/login <<EOF
session required /lib/security/pam_limits.so
EOF
For RHEL5, use the following:
cat >> /etc/profile <<EOF
if [ \$USER = "oracle" ]; then 
 if [ \$SHELL = "/bin/ksh" ]; then
 ulimit -p 16384
 ulimit -n 65536
 else
 ulimit -u 16384 -n 65536
 fi
 umask 022
fi
EOF

cat >> /etc/csh.login <<EOF
if ( \$USER == "oracle" ) then
 limit maxproc 16384
 limit descriptors 65536
 umask 022
endif
EOF
For SLES 9, use the following:
cat >> /etc/profile.local <<EOF
if [ \$USER = "oracle" ]; then 
 if [ \$SHELL = "/bin/ksh" ]; then
 ulimit -p 16384
 ulimit -n 65536
 else
 ulimit -u 16384 -n 65536
 fi
 umask 022
fi
EOF

cat >> /etc/csh.login.local <<EOF
if ( \$USER == "oracle" ) then
 limit maxproc 16384
 limit descriptors 65536
 umask 022
endif
EOF
 
 
Part III: 
Installing Oracle 
 
Oracle Database 10g Release 2 can be downloaded from OTN. Oracle offers a development and testing license free of charge. However, no support is provided and the license does not permit production use. A full description of the license agreement is available on OTN.
The easiest way to make the Oracle Database 10g Release 2 distribution media available on your server is to download them directly to the server.
Use the graphical login to log in as oracle.
Create a directory to contain the Oracle Database 10g Release 2 distribution:
mkdir 10gR2_db
To download Oracle Database 10g Release 2 from OTN, point your browser (Firefox works well) to http://www.oracle.com/technology/software/products/database/oracle10g/htdocs/10201linuxsoft.html. Fill out the Eligibility Export Restrictions page, and read the OTN License agreement. If you agree with the restrictions and the license agreement, click on I Accept.
Click on the 10201_database_linux32.zip  link, and save the file in the directory you created for this purpose (10gR2_db)—if you have not already logged in to OTN, you may be prompted to do so at this point.
Unzip and extract the file:
cd 10gR2_db
unzip 10201_database_linux32.zip
Install the Software and Create a Database
Log in using the oracle account.
Change directory to the location where you extracted the Oracle Database 10g Release 2 software. Ex:
$ cd $HOME/10gR2_db
Change directory to Disk1.
Ex:
$ cd database
Start the Oracle Universal Installer.
$ ./runInstaller
  1. Select Installation Method
    • Select Basic Installation
    • Oracle Home Location: /u01/app/oracle/product/10.2.0/db_1
    • Installation Type: Enterprise Edition (1.3GB)
    • UNIX DBA Group:  oinstall
    • Make sure Create Starter Database is checked
    • Global Database Name: demo1
    • Enter the Database Password and Confirm Password
    • Click on Next
  2. Specify Inventory Directory and Credentials
    • Inventory Directory: /u01/app/oracle/oraInventory
    • Operating System group name:  oinstall
    • Click on Next
  3. Product-specific Prerequisite Checks
    • If you've been following the steps in this guide, all the checks should pass without difficulty. If one or more checks fail, correct the problem before proceeding. 
    • Click on Next
  4. Summary
    • A summary of the products being installed is presented.
    • Click on Install.
  5. Configuration Assistants
    • The Oracle Net, Oracle Database, and iSQL*Plus configuration assistants will run automatically
  6. Execute Configuration Scripts
    • At the end of the installation, a pop up window will appear indicating scripts that need to be run as root.  Login as root and run the indicated scripts.
    • Click on OK when finished.
  7. End of Installation
    • Make note of the URLs presented in the summary, and click on Exit when ready.
  8. Congratulations! Your new Oracle Database 10g Release 2 database is up and ready for use.
 

 

Friday, November 19, 2010

Multimedia (MP3, MPEG-4, AVI, DiVX, etc.) support in Fedora 13

Why doesn’t Fedora support MP3 ‘out of the box’?

Fedora cannot include support for MP3 or DVD video playback or recording. MP3 formats are patented, and the patent holders have not provided the necessary licenses. Fedora also excludes other multimedia software due to patent, copyright, or license restrictions, such as Adobe Flash Player and RealNetworks RealPlayer.

That doesn’t mean you can’t play .mp3 files in Fedora, it just takes a bit of work (not much).

Follow these instructions to get mp3 and other multimedia support on your Fedora 13.
Open a terminal and become root, then run this command:

# rpm -ivh http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-stable.noarch.rpm
# rpm -ivh http://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-stable.noarch.rpm

Now, Install all other plug ins..

# yum -y install gstreamer-plugins-bad gstreamer-plugins-ugly xine-lib-extras-nonfree gstreamer-ffmpeg

After successful installation, open Amarok or any other multimedia player and try to play the mp3 file and see if all goes fine and you are able to hear the music.

XMMS
To install xmms and make it MP3-capable, start by doing this:

# yum install xmms xmms-mp3

MPEG, QuickTime, AVI, and DVDs
MPEG (the format used on DVDs) represents itself as an open standard, but most Linux distributions won't ship software that read it because of blocking patents held by MPEGLA. AVI and Apple QuickTime have proprietary codecs covered by patents, so most Linux distributions won't ship software that decodes them, either.

Unfortunately, the alternate front end xine is even more broken. It can be installed this way:

# yum install xine xine-lib libdvdcss

Doing this will also install a number of support libraries, including the libdvdcss plugin

VLC Player:
# rpm -ivh http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-stable.noarch.rpm
# yum -y install vlc

Wednesday, November 10, 2010

Restore GRUB

GRUB is a boot loader commonly used with linux operating system. It can be used to managed dual boot environment where linux and windows can coexist easily in a same machine without problem provided you install the windows OS first so that when you install linux, GRUB will overwrite Windows boot loader and automatically detect and manage both operating system the next time you boot your computer. Problems will happen if you alter your partitions outside the knowledge of GRUB, for example, you create new partition in your hard drive using windows. This will cause GRUB to automatically go into GRUB shell when boot. To restore back your GRUB is very simple, just follow easy steps below:

1. find in which partition does GRUB store its configuration file, which is your /boot partition. (hd0,2) means third partition of the first hard drive
grub> find /boot/grub/stage1
(hd0,2)

2. set the root for GRUB to be (hd0,2)
grub> root (hd0,2)

3. write GRUB to the Master boot record(MBR) of your hard drive. Change (hd0) to (hd0,2) to write GRUB to your /boot partition instead
grub> setup (hd0)

4. Reboot machine
grub> reboot

All those steps can also be used using livecd, if let say the grub shell did not come out but you cannot boot your machine or you cannot boot your linux due to messed up GRUB. just boot from livecd, open a terminal, and type "grub" as a superuser to go to GRUB shell

Tuesday, November 9, 2010

Create bootable Live USB drives for Linux distributions without burning a CD

UNetbootin allows you to create bootable Live USB drives for Ubuntu, Fedora, and other Linux distributions without burning a CD. It runs on both Windows and Linux. You can either let UNetbootin download one of the many distributions supported out-of-the-box for you, or supply your own Linux .iso file if you've already downloaded one or your preferred distribution isn't on the list.

Requirements

  • Microsoft Windows 2000/XP/Vista/7, or Linux.
  • Internet access for downloading a distribution to install, or a pre-downloaded ISO file

Features

UNetbootin can create a bootable Live USB drive, or it can make a "frugal install" on your local hard disk if you don't have a USB drive. It loads distributions either by downloading a ISO (CD image) files for you, or by using an ISO file you've already downloaded.



The current version has built-in support for automatically downloading and loading the following distributions, though installing other distributions is also supported


Installation & Screenshots

1. If using Windows, run the file, select an ISO file or a distribution to download, select a target drive (USB Drive or Hard Disk), then reboot once done.






2. If using Linux, make the file executable (using either the command chmod +x ./unetbootin-linux, or going to Properties->Permissions and checking "Execute"), then start the application, you will be prompted for your password to grant the application administrative rights, then the main dialog will appear, where you select a distribution and install target (USB Drive or Hard Disk), then reboot when prompted.

 
3. After rebooting, if you created a Live USB drive by selecting "USB Drive" as your install target, press the appropriate button (usually F1, F2, F12, ESC, or backspace) while your computer is starting up to get to your BIOS boot menu and select USB drive as the startup target; otherwise if there's no boot selection option, go to the BIOS setup menu and change the startup order to boot USB by default. Otherwise, if you did a "frugal install" by selecting "Hard Disk" as your install target, select the UNetbootin entry from the Windows Boot Menu as the system boots up.

Configuring Ldap for Server and Client

compat-openldap.i386 0:2.1.30-6.4E
openldap-clients.i386 0:2.2.13-6.4E
openldap-devel.i386 0:2.2.13-6.4E
openldap-servers.i386 0:2.2.13-6.4E
openldap-servers-sql.i386 0:2.2.13-6.4E

yum install *openldap* -y

chkconfig --levels 235 ldap on
service ldap start

slappasswd
New password:
Re-enter new password:
{SSHA}cWB1VzxDXZLf6F4pwvyNvApBQ8G/DltW

vi /etc/openldap/slapd.conf

#68 database        bdb
#69 suffix          "dc=example,dc=com"
#70 rootdn          "cn=admin,dc=example,dc=com"
#71 rootpw          {SSHA}cWB1VzxDXZLf6F4pwvyNvApBQ8G/DltW


create users test1 and test2

Migrate local user to LDAP (We assume that users test1 and test2 exist in our system)
grep root /etc/passwd > /etc/openldap/passwd.root
grep test1 /etc/passwd > /etc/openldap/passwd.test1
grep test2 /etc/passwd > /etc/openldap/passwd.test2

Update default settings on file /usr/share/openldap/migration/migrate_common.ph
#71 $DEFAULT_MAIL_DOMAIN = "example.com";
#74 $DEFAULT_BASE = "dc=example,dc=com";

cd /usr/share/openldap/migration
migrate_passwd.pl /etc/openldap/passwd.root /etc/openldap/root.ldif
migrate_passwd.pl /etc/openldap/passwd.test1 /etc/openldap/test1.ldif
migrate_passwd.pl /etc/openldap/passwd.test2 /etc/openldap/test2.ldif

Update root.ldif file for the "admin" of LDAP Server

vi /etc/openldap/root.ldif

#1 dn: uid=root,ou=People, dc=example,dc=com
#2 uid: root
#3 cn: admin
#4 objectClass: account

Create a domain ldif file

cat /etc/openldap/example.com.ldif

dn: dc=example,dc=com
dc: example
description: LDAP Admin
objectClass: dcObject
objectClass: organizationalUnit
ou: rootobject

dn: ou=People, dc=example,dc=com
ou: People
description: Users of example
objectClass: organizationalUnit

Import all users in to the LDAP

ldapadd -x -D "cn=admin,dc=example,dc=com" -W -f  /etc/openldap/example.com.ldif

ldapadd -x -D "cn=admin,dc=example,dc=com" -W -f  /etc/openldap/root.ldif

ldapadd -x -D "cn=admin,dc=example,dc=com" -W -f  /etc/openldap/test1.ldif

ldapadd -x -D "cn=admin,dc=example,dc=com" -W -f  /etc/openldap/test2.ldif

service ldap restart

Test LDAP Server

ldapsearch -x -b 'dc=example,dc=com' '(objectclass=*)'

Client Configuration
authconfig-tui

use LDAP

Server: ldap.example.com
Base DN: dc=example,dc=com

Tuesday, October 26, 2010

How to setup multimedia on CentOS-5

CentOS ships with basic sound support for audio content encoded with codecs for a variety of sound formats, including .wav and .ogg files. The alsa-utils and sox audio players are included for a cron or TUI environment; xmms is trivial to rebuild SRPMs. The popular full featured xmms player is omitted by the upstream, probably in light of the so-called Fraunhofer restrictions and non-free license requirements to address.
 


For those in jurisdictions not affected by such, the following procedures will describe how to setup multimedia support under CentOS 5. After completing the steps below, you should be able to play dvds on your computer. You'll also be able to view different media formats, for example Xvid, dvix, quicktime etc. You will also have mplayer integrated as a browser plugin which will allow you to view streaming video/audio content from within Firefox.
Some recommendations should be mentioned pertaining to the yum priorities plug-in. This will prevent accidentally overwriting packages from the base repositories. Also note the following needs to be performed as root user in a command line or terminal.


Please consider following the wiki document to assist in setting up the priorities plug-in, due to the fact that we are adding some third party repositories, described in the Priorities article.

Step 1: Add the RPMforge repo for your CentOS version (needed for majority of multimedia files)
 
See the RPMForge article on the wiki on how to do so.






Step 2: Add the Macromedia repo (optionally needed for flash)
 
rpm -Uhv http://linuxdownload.adobe.com/adobe-release/adobe-release-i386-1.0-1.noarch.rpm







 Flash is also installed from RPMforge below if you don't add Macromedia repository.

Step 3: Install multimedia applications (command line to install required packages)

 
The following steps will use the yum package manager to install all the binaries needed to have full multimedia support. Note there will be a lot of dependencies
 
yum install libdvdcss libdvdread libdvdplay libdvdnav lsdvd mplayerplug-in mplayer mplayer-gui compat-libstdc++-33 flash-plugin gstreamer-plugins-bad gstreamer-plugins-ugly gstreamer-ffmpeg libquicktime

Step 4: Installing w32Codecs (required for xvid and other proprietary formats)
 
wget www1.mplayerhq.hu/MPlayer/releases/codecs/mplayer-codecs-20061022-1.i386.rpm ; rpm -ivh mplayer-codecs-20061022-1.i386.rpm
wget www1.mplayerhq.hu/MPlayer/releases/codecs/mplayer-codecs-extra-20061022-1.i386.rpm; rpm -ivh mplayer-codecs-extra-20061022-1.i386.rpm

You should now have full multimedia and video support for most popular formats.
If you happen to have problems with playing video's (eg. the player crashes or you have no image), try to disable System > Preferences > Desktop Effects (Compiz) and see if that fixes your problems.

CentOS/Fedora forgotten password

What to do if you forgot the password for your CentOS/Fedora/Redhat machine?? Here are some simple steps to change back the password by entering into single user mode of your machine provided you do not forgotten your grub password if you have set it ;)

  1. Reboot your machine
  2. Press 'Esc' key once grub starts loading
  3. Select your kernel press 'e' on one of the kernel to edit the kernel parameter
  4. Press 'e' on the line that starts with 'kernel /vmlinuz...'
  5. Append ''single" or "1" at the end of the line
  6. Press 'Enter'
  7. Press 'b' to boot from the appended kernel
  8. You are now in the single user mode of your linux machine once you get to the shell. You can now change the password of your account using command passwd
  9. Reboot back your machine normally
  10. You can now log in to your machine using your new password

Setting up samba with password protection

To easily share your files to linux and windows clients, samba is still the preferred choice. In this guide I will show how to setup a samba server on centos 5 machine, that can be accessed only by certain people protected by password.

  1. Install samba on the server
    • # yum install samba
  2. Create the group that all the samba users will be contained in, for example 'samba'
    • # groupadd samba
  3. Create samba users and add it to the above group, which is in this example is 'samba'. Below is the example to create a user named 'user1' and add it to group 'samba'. Set the password for user1
    • # useradd user1 -g samba
    • # passwd user1
  4. Create the directory to be shared. In this example, i will use /home/shared. Change the ownership to root and group ownership to the 'samba' group. Change permission so that only user and group can read write and execute
    • # mkdir /home/shared
    • # chown -R root.samba /home/shared
    • # chmod -R 775 /home/shared
  5. Below is a simple setting of samba
    • [global] workgroup = samba
      server string = Samba Server
      security = user [shared_folder]
      comment = Sharing place
      path = /home/shared
      public = no
      writable = yes
      printable = no
      write list = @samba
      create mask = 0755
      force create mode = 0755
      directory mask = 0775
      force directory mode = 0775
    • What the above setting does basically is to setup /home/shared as samba shared directory but can only be accessed by user from group samba
  6. Add user/users to samba
    • # smbpasswd -a user1
  7. Start smb service, restart if it has already been started
    • # /etc/init.d/smb start
  8. 'user1' can now access the samba server using address 'smb://samba_server_ip_address/shared_folder' at any nautilus address bar. For windows client, you can see at your 'My Network Places' and find a workgroup named 'samba'

NFS quick howto for centos 5

To use nfs successfully, you have to configure the server and the client. In this example, the client is 192.168.0.3 and the server is 192.168.0.1. The folder to be shared is /home/sharing, and to be mounted to /mnt on the client

On the server
  1. Make directory that you want to use.
    • # mkdir /home/sharing
  2. Edit /etc/exports, insert the client machine's ip
    • # vi /etc/exports
      • Add this line:
        • /home/sharing 192.168.0.3/255.255.255.255(rw,sync)
      • Save
  3. Edit /etc/hosts.allow
    • # vi /etc/hosts.allow
      • Add this line:
        • portmap: 192.168.0.0/255.255.255.0
      • Save
  4. Start nfs and portmap
    • # /etc/init.d /nfs start
    • # /etc/init.d/portmap start
On the client
  1. Start portmap
    • # /etc/init.d/portmap start
  2. Mount the nfs folder
    • # mount 192.168.0.1:/home/sharing /mnt
  3. Check /var/log/messages for any error that might occur
    • # tailf /var/log/messages
  4. Use mount to check if the folder is mounted properly
    • # mount
      • This should be the output:
        • 192.168.0.1:/home/sharing on /mnt type nfs (rw,addr=192.168.0.1)
  5. Edit /etc/fstab to mount the shared folder on boot
    • # vi /etc/fstab
      • Add this line
        • 192.168.0.1:/mnt/sdb1/backup /mnt nfs rw,hard,intr 0 0
      • Save
You can use 'man exports' to see the options available for /etc/exports

List your hardware

If you want to view the hardware spec of your pc, you can use this command
--> lshwThis is how you see the hardware spec on your pc.



By default, this command is installed on ubuntu linux but not installed on Centos. You can use you tools like yum to install it
--> yum install lshw

How to format your flash drive

This is how you can format your flash drive(thumbdrive, pendrive) in any linux machine

1. To see what is the filesystem for your flashdrive
  • type -> df



2. Type -> mkfs /dev/sdb1
(The /dev/sdb1 is according to your outcome of the df command previously: refer above diagram)
This command will format the flash drive to ext3 format which is the default.
To format it to fat;
type -> mkfs -t vfat /dev/sdb1