Thursday, April 16, 2009

How to create a local Repository for Linux!

Creating a Local Repository of Yum and apt:-

You should have a FTP server or HTTP server to make yum actually working. However since we haven't really gone through setting up FTP or HTTP server, please read-on and understand the process. If you have got vsftpd installed, use that. Otherwise, don't forget to actually set it up yourself later.

Here we will create a local repository for Fedora and CentOS in the easy way.

0. You should have the yum as well as the createrepo package installed first.

1. Create the directory to hold the repository.

mkdir -p /var/ftp/pub/yum-repo/centos/
mkdir -p /var/ftp/pub/yum-repo/fedora/

2. createrepo /var/ftp/pub/yum-repo/centos/ ; createrepo /var/ftp/pub/yum-repo/fedora/ will create the local yum repository by creating a folder named "repodata with four xml files named, filelists.xml.gz, other.xml.gz, primary.xml.gz and repomd.xml

You will have to run the createrepo command each time a rpm is added there.

3. Now in the client's yum.conf, add the repo directly. However in recent versions, the repositories are put in a separate directory called /etc/yum.repos.d/ . If so, put the contents in a filename, with the extension .repo

[humanlinux repo]
name=Fedora Core $releasever - humanlinux Local Repo
baseurl=file:///var/ftp/pub/yum-repo/fedora/
enabled=1
gpgcheck=0
#gpgkey=file:///path/to/your/RPM-GPG-KEY

Fedora Specific Local Repository:- 

NB : You can create directories inside /var/ftp/pub/yum-repo/fedora/ to look like /var/ftp/pub/yum-repo/fedora/base/8/i386 , /var/ftp/pub/yum-repo/fedora/updates/8/i386 , /var/ftp/pub/yum-repo/fedora/base/9/i386, /var/ftp/pub/yum-repo/fedora/updates/9/i386 and so on.

1) Filling the repos with RPMs:- 

Copy the rpm packages to /var/ftp/pub/yum-repo/fedora/ or /var/ftp/pub/yum-repo/fedora/base/8/i386 from the DVD's Packages directory.

OR

rsync from a rsync supported mirror from the list, http://mirrors.fedoraproject.org//mirrorlists/publiclist/Fedora/8/ like rsync://ftp.sh.cvut.cz/fedora/linux and

rsync -avrt rsync://ftp.sh.cvut.cz/fedora/linux/releases/8/Everything/i386/os/ /var/ftp/pub/yum-repo/fedora/base/8/i386 (remember to have a slash after os/ :-))

2) Updates and regular downloading:- 

/var/ftp/pub/yum-repo/fedora/updates/8/i386

rsync the updates from rsync://ftp.sh.cvut.cz/fedora/linux/updates/8/i386/ to /var/ftp/pub/yum-repo/fedora/updates/8/i386

And then enter the command in a cron job too, to download the updates frequently.

Creating Apt repository:- 

This is done using the apt-mirror tool. Download and install apt-mirror first and then edit the /etc/apt/mirror.list ( to list which packages tree should be mirrored ) which is similar to /etc/apt/sources.list.

apt-mirror will do the rest of the job. Once it is finished, clean up the repositories by running /var/spool/apt-mirror/var/clean.sh.

tell2humanlinux@gmail.com

Wednesday, April 15, 2009

How to sent gmail from/using terminal!

We can sent emails using the terminals. This is an advantage if the internet connection is very slow , since it take much time to load the GUI web interface.
Here are the steps to sent a gmail using/from the terminal.

1)We have to install a package
for Debain : apt-get install ssmtp
gnu/linux : yum install ssmtp

2)edit the file /etc/ssmtp/ssmtp.conf with your favourite editor.
Add the following lines at the end.

AuthUser=youremailaddress(senders adress)
AuthPass=email password
FromLineOverride=Yes
mailhub=smtp.gmail.com
Use STARTTLS=YES


save & quit!

3)To sent an email, type this on the terminal

echo "This is a test mail' | mail -s "hello" receiptemailaddress@gmail.com
tell2humanlinux@gmail.com

How to turn-on the num lock on every boot-up!

It is frustating to see that the numlock is turned off on very reboot in ubuntu. But it is quite easy to fix it.Just install a tiny package.

sudo apt-get install numlockx

This can:-
1)Control the state of NumLock

2)Provides control over the keyboard number lock from scripts.
3)Particularly useful for use with .xinitrc/.xsession or GDM/XDM/KDM sessions
4)Included is an optional script that can be used to start numlockx automatically
in every X session.

thankyou:-
tell2humanlinux@gmail.com

Tuesday, April 14, 2009

How to put .htpasswd protection for a web directory!

Protecting content on the web is something that most savvy users will have to do at one point or another. Whether the content is personal or professional, there comes a time when that content must only be seen by "authorized" eyes. The Apache web server ( that daemon that serves up your marvelous content ) allows a user to configure two files to facilitate this very purpose. Those files are .htaccess and .htpasswd.

.htaccess
The .htaccess file is a simple text file placed in the directory you want the contents of the file to affect. The rules and configuration directives in the .htaccess file will be enforced on whatever directory it is in and all sub-directories as well. In order to password protect content, there are a few directives we must become familiar with. One of these directives in the .htaccess file ( the AuthUserFile directive ) tells the Apache web server where to look to find the username/password pairs.
.htpasswd
The .htpasswd file is the second part of the affair. The .htpasswd file is also a simple text file. Instead of directives, the .htpasswd file contains username/password pairs. The password will be stored in encrypted form and the username will be in plaintext.
Apache Server
We have to make some changes on the apache conf file, & rester the service.The procedure is explained below.

Creating an .htaccess file:-
goto the directory you need to password protect. create a file named .htaccess.
add the following lines into it.

AuthName "Hello user!"
AuthType Basic
AuthUserFile /usr/local/humanlinux/.htpasswd (this is the location of the .htpasswd, you have to specify accourdingly)
Require user john (replace the john with desired username)

Save the file.


Creating an .htpasswd file:-


To create a .htpasswd file in /usr/local/humanlinux

htpasswd -c /usr/local/humanlinux/.htpasswd john

Note the '-c' is only used when creating a new .htpasswd file.

To add dave to an existing .htpasswd file located in /usr/local/humanlinux/ the following command will be used.

htpasswd /usr/local/humanlinux/.htpasswd dave

Sample .htpasswd File

Below is a sample .htpasswd file that contains users john and dave

john:n5MfEoHOIQkKg
dave:9fluR/1n73p4c


Changes in the apache conf file:-

open the httpd.conf file using your favourote editor.goto the diretory area.


AllowOverride All


you have to specify the correct path for the directory you need to pasword protect.Here i have protected the directory /home/humanlinux/public_html/protected.

Restart the apache service.


Troubleshooting

  • Make sure that the path specified in AuthUserFile is the correct full path. This is a major cause of problems. If Apache cannot find the .htpasswd file, then all attempts will fail.
  • Make sure the permissions on the .htaccess and .htpasswd files are set so that Apache can read them.
    • chmod 0644 .htaccess
    • chmod 0644 .htpasswd
  • Other issues may be out of your control. Web administrators can lock down Apache so that it ignores all .htaccess files it encounters. This can be achieved with an AllowOverride None directive and option on the ServerRoot/DocumentRoot directories. If this is the case (.htaccess not allowed) you will have to kindly ask your web administrator to allow .htaccess files with authorization directives in your personal web directory. This can be achieved with AllowOverride AuthConfig directive and option.
tell2humanlinux@gmail.com

Saturday, April 11, 2009

How to create an account in cPanel!

cPanel is a linux based web hosting control panel that provides a graphical interface and automation tools designed to simplify the process of hosting a web site. cPanel utilized a 3 tier structure that provides functionality for administrators, resellers, and end-user website owners to control the various aspects website and server administration through a standard web browser.
 In addition to the GUI interface cPanel also has command line and API based access that allows third party software vendors, web hosting organizations, and developers to automate standard system administration processes.

cPanel is designed to function either as a dedicated server or virtual private server and it supports centOS, Red Hat Linux, and FreeBSD.

Application based support includes Apache, PHP, mySQL, Postgres, Perl, Python, and BIND. Email based support includes POP3, IMAP, SMTP services.

Here are the steps to create an account in cPanel.

1)Login to the whm using your root username and password.

2)to view the currently created accounts , click on 'account information'->list accounts.

3)To create, on the right hand side of the page you can see a menu, click on Account Functions -> Create a new account.

4) give the account details.
Domain name :
user name :
password :
email :

The new account has been created. To goto to the cpanel for the next time for a particular account from whm, goto the account information->list account info.

you will be able to find an icon of cPanel next to the domain.click on that to navigate to the cpanel.

tell2humanlinux@gmail.com

Friday, April 10, 2009

How to install wordpress!

WordPress is an open source blog publishing application. WordPress is the official successor of b2\cafelog which was developed by Michel Valdrighi. The latest release of WordPress is version 2.7.1, released on 10 February 2009.WordPress has a templating system, which includes widgets that can be rearranged without editing PHP or HTML code, as well as themes that can be installed and switched between. The PHP and HTML code in themes can also be edited for more advanced customizations. WordPress also features integrated link management; a search engine-friendly, clean permalink structure; the ability to assign nested, multiple categories to articles; multiple author capability; and support for tagging of posts and articles. Automatic filters that provide for proper formatting and styling of text in articles (for example, converting regular quotes to smart quotes) are also included. WordPress also supports the Trackback and Pingback standards for displaying links to other sites that have themselves linked to a post or article. Finally, WordPress has a rich plugin architecture which allows users and developers to extend its functionality beyond the features that come as part of the base install.


The instllation of wordpress is quite simple.

1)Download the latest version of wordpress and extract it.

2)Place the WordPress files in the desired location on your web server,using FTP

* If you want to integrate WordPress into the root of your domain (e.g. http://example.com/), move or upload all contents of the unzipped WordPress directory (but excluding the directory itself) into the root directory of your web server.
* If you want to have your WordPress installation in its own subdirectory on your web site (e.g. http://example.com/blog/), rename the directory wordpress to the name you'd like the subdirectory to have and move or upload it to your web server. For example if you want the WordPress installation in a subdirectory called "blog", you should rename the directory called "wordpress" to "blog" and upload it to the root directory of your web server.


3)Here i am uploading the folder(blog) to public_html, using ftp. Make sure that you upload the folder as a user, not the root.

4)now goto the cpanel,and create a mysql user and a database.please remember the dbname, user and password.

5)then goto filemanager, inside the uploaded folder (blog), edit the file wp-config-sample.php

6)rename the wp-config-sample.php to wp-config.php.

7)edit the wp-config.php and insert the db details of the one which we have created.


Here is the default wp-config-sample.php, you will need to replace the default values in this file with your own specific database settings.

define('DB_NAME', 'putyourdbnamehere'); // The name of the database
define('DB_USER', 'usernamehere'); // Your MySQL username
define('DB_PASSWORD', 'yourpasswordhere'); // ...and password
define('DB_HOST', 'localhost'); // 99% chance you won't need to change this value

usually the DB_HOST must be 'localhost'.if it is not working contact your web hosting provider.

8)Run the WordPress installation script by accessing wp-admin/install.php in your favorite web browser.

* If you installed WordPress in the rootl directory, you should visit: http://example.com/wp-admin/install.php
* If you installed WordPress in its own subdirectory called blog, for example, you should visit: http://example.com/blog/wp-admin/install.php

9)The instllation process will now beging. The screen shots fir the instllation is given below.







10)goto www.yourdomain.com/blog/wp-login.php to login for the next time.

thankyou
tell2humanlinux@gmail.com