Linux News|Linux Install sidebyside windows|Ubuntu|Linux Help|Installing Apache and php from source

Showing posts with label Debian. Show all posts
Showing posts with label Debian. Show all posts

Thursday, August 30, 2012

Converting CHM to PDF in Linux

CHM files, known as Microsoft Compressed HTML Help files, are a common format for eBooks and online documentation. They are basically a collection of HTML files stored in a compressed archive with the added benefit of an index.

Under Linux, you can view a CHM file with the xchm viewer. But sometimes that is not enough. Suppose you want to edit, republish, or convert the CHM file into another format such as the Plucker eBook format for viewing on your Palm. To do so, you first need to extract the original HTML files from the CHM archive.
This can be done with the CHMLIB (CHM library) and its included helper application extract_chmLib.
In Debian or Ubuntu:

$ sudo apt-get install libchm-bin
$ extract_chmLib book.chm outdir
where book.chm is the path to your CHM file and outdir is a new directory that will be created to contain the HTML extracted from the CHM file. In other Linuxes, you can install it from source. First download the libchm source archive from the above website. I could not get the extract_chmLib utility to compile under the latest version 0.38, so I used version 0.35 instead.

$ tar xzf chmlib-0.35.tgz
$ cd chmlib-0.35/
$ ./configure
$ make
$ make install
$ make
After doing the 'make examples', you will have an executable extract_chmLib in your current directory. Here is an example of running the command with no arguments and the output it produces:
$ ./extract_chmLib                    usage: ./extract_chmLib 
After running the utility to extract the HTML files from your CHM file, the extracted files will appear in . There would not be an 'index.html' file, unfortunately. So you will have to inspect the filenames and/or their contents to find the appropriate main page or Table of Contents.
Now the HTML is yours to enjoy!

   I have learnt this from lots of available sites and main reference I have given below.

References:http://madphilosopher.ca/2006/09/how-to-convert-chm-files-under-linux/

Monday, March 5, 2012

Install_flash_player_11_linux.x86_32.tar.gz,Install_flash_player_11_linux.x86_64.tar.gz in 64/32 bit in ubuntu/linux for firefox|Installing Adobe Flash Player in 32 and 64 bi ubuntu/linux for firefox|Installing latest version of Adobe Flash Player in ubuntu for firefox|Install latest Flash Player in ubuntu/linux for firefox|Installing Adobe flash player from source file for firefox.

To install flash player in ubuntu through source file is much easier as installing from binary file. when this post was written there was no debian file available for the current version of flash player although rpm package is available but no debian package available. Usually now flash player is coming as shared library which you have to put in a specified location and firefox and other browser will pick it automatically as follows. Download the source file for your machine from "here".

Now follow these steps:
Step 1:  Using the tar utility extract the file or right click on the file and extract the file.
Step 2:   Copy the file with ".so" extension to ".mozilla/plugins" directory which is in your home directory. Here ".mozilla" will be hidden in your home directory.If there is no "plugins" folder then create and copy that file in that folder and restart the firefox.

Wednesday, February 8, 2012

Installing debian files in ubuntu 10.04|Saving debian files while installing software/packages in ubuntu|Installing vlc in ubuntu

For new users installing software in ubuntu is cumbersome as downloading your softwares again after every fresh installation is annoying here is a solution for you if you have installed ubuntu and you want to store the softwares as you do in windows for future use.

When you install any package in ubuntu using apt-get install it first get downloaded in the cache located in /var/cache/apt/archives. Here all the debian files which are required by your software are downloaded first or you can say all the dependencies related to your software are stored here and as the downloaded finishes dpkg which is debian package manager installs the debian files using the files in current directory.So if you have debian files stored some where you can manually install your software,so our target here is to store debian files as we install any software so that we can manually install it in future if required.


Take an example suppose we are installing vlc media player,do as follows:
1. Clean the cache
[sudo apt-get clean]

2. Install vlc
[sudo apt-get install vlc]

3. Save the debian files related to vlc to some directory ,here I am using /home/tarun/vlc,you can choose any directory.
[cp  /var/cache/apt/archives/*.deb   /home/tarun/vlc]

4. Now to reinstall vlc on some other machine having the same OS,copy the files to some place on the harddisk and reach to that directory using cd command.
[cd vlc]       //here you have to reach the vlc directory no matter where you have placed it
Now install vlc as follows:
[sudo dpkg -i *.deb]

Friday, January 6, 2012

Installing C/C++ compiler in Ubuntu|c++ package download for ubuntu linux|Running C/C++ program in ubuntu/linux

In this article I will be showing the way to install C/C++ compiler in ubuntu ,I am using ubuntu 10.04.
By the way it is same for all ubuntu distribution as far as I am concern. There are two things you will learn here,First is to install compiler and second is saving downloaded files so that if you install ubuntu again you don't need to download again all debian files.
Installing C/C++ compiler in Ubuntu|c++ package download for ubuntu linux|Running C/C++ program in ubuntu/linux
In debian distribution such as ubuntu is there are some binary packages with .deb as extension which are dependent on some other packages which are also with .deb extension. The compiler we will be installing is gcc for c and g++ for c++,g++ supports both c and c++.
First make sure that you should have internet connection on your machine.

Open the terminal by going through Applications->Accessories->Terminal.

Step 1: Update your machine as follows:
[sudo apt-get update]

Skip this step if you have already updated.

Step 2: Clean the cache
[sudo apt-get clean]

Step 3: Install the build-essential package which contains gcc(Gcc compiler collection) ,make utility and other utilities for installing the software from source,if you don't know about installing software from source then don't worrry you will learn by experience.

[sudo apt-get install build-essential]

Step 4: After installing copy the downloaded files so that you don't have to go through these downloads again as follows:
Make a directory on desktop named as build-essential as follows:
If you are in home directory which is shown by '~' sign in your terminal as

[tarun@chawla:~$]
                          ^
                           This shows your current location in the / directory

If you are not in your home directory then do as follows:
[cd ~]
[mkdir Desktop/build-essential]
[cp  /var/cache/apt/archives/*.deb  Desktop/build-essential]
[sudo apt-get clean]

Now suppose you have installed ubuntu again on your computer and you need to install compiler again and you have stored build-essential directory that you have made above safe at some place then proceed as follows:

copy the build-essential directory on your Desktop and open the terminal ,reach to the home directory and do the following steps:

[sudo dpkg -i  Desktop/build-essential/*.deb]
In the above case I have stored and installed form Desktop and if you want to install and store at any other place then change the path accordingly.
Now you have installed compiler within seconds.
Running a c++ program


#include<iostream>
using namespace std;
int main()
{
cout<<"Hello world"<<endl;
}

Save it as first.cpp on your desktop.
Open the terminal and do as follows.
[g++ Desktop/first.cpp -o Desktop/first.o]
                                                         ^
                                                      first.o will be created if no error occurs
[cd Desktop]
[./first.o]

Running a C program


#include<stdio.h>
//using namespace std;
int main()
{
printf("Hello world\n");
}


Save it as second.c on your Desktop.

[g++ Desktop/second.c -o Desktop/second.o]
[cd Desktop]
[./second.o]

Here you can use gcc or g++ as g++ supports both.

enjoy the day bhai......
If you have any question then write down the comments,I will be pleased to help you.

Wednesday, January 4, 2012

Installing Apache and Php from source in Linux


In this article you will learn how to install Apache and Php from source.If you are installing from binary files whether it is rpm or debian based then everything will be installed by default and you don't have to worry about inner details but if you are new to php and apache and I am assuming so,you should know some working details before going into programming. When I write this post I did not have any experience in php programming but I have installed php and apache from source but it has taken time. So I am here to solve your problem and give some details regarding inner working.So lets start to setup environment for php programming----

Installing Apache from source in any linux distribution:

I am using ubuntu 10.04(Lucid) for all compilation and installing in this tutorial. Before installing from source make sure that all tools required for installing is already installed on your linux system such as gcc compiler,make utility because all these tools are needed for installation from source.
I am using httpd-2.2.17.tar.gz ,extract it to the desired location and open the terminal and reach that location where you have extracted the httpd file.
Before proceeding further make a directory it is your installation directory where you will install apache,I am using "/home/tarun/apache" where all installed files will be stored.
After extracting a folder "httpd-2.2.17" will be made. Enter this folder using terminal.
Now follow these steps:

[] is used to differentiate commands from strings
Step 1:
[./configure --prefix="/home/tarun/apache" --enable-so] and press enter.
Here prefix option redirects the installation to your directory and second option enables shared library which I don't know as I am like you,we will learn as we will go on.
Other option are also available and to view them use command as [./configure --help].

Step 2:
If everythings goes fine without any error then proceed:
[make && make install]
if  your have read and write permission of your installation directory then you don't need to have root permission using sudo but if you don't have permission then use sudo before commands.Here I am assuming that you have some basic experience of any Linux OS.

Now check the folder now it contains files and folders.
Before moving further edit the httpd.conf file located in /home/tarun/apache/conf as follows:
Search for User & Group and set user to your name and group to your group.


Checking Apache installation:

Start the apache using this command and here you will need root permissions so use sudo as follows:
[sudo /home/tarun/apache/bin/apachectl start] and press enter Now open your browser and run http://localhost this will open by default html file for your server and will show positive results if installed correctly. By positive result means that the default html file is run correctly as default file may differ from one version to another. In my case default file shows "It Works" string if installed correctly.

Stop the server using command below:
[sudo /home/tarun/apache/bin/apachectl stop]



Php Installation in any Linux distribution from source:

Make a folder in your previous installation directory which will now be installtion directory for php and for this I am using "/home/tarun/apache/php".
As php is build to talk to many products and distribution so there are lots of option provided as in apache but here we will only configure those option which are sufficient for running php on your machine. So before going further extract the tar file on some location and reach to that php directory from terminal. Here I am using php-5.3.4.
So reach to php-5.3.4 in terminal where you have placed it and make sure you have reqired permission or you can use sudo to fulfill that.

Step 1:
[./configure --help] This will list the options available with php.

Step 2:
[./configure --with-apxs2=/home/tarun/apache/bin/apxs --prefix=/home/tarun/apache/php]
Here first option is for apache extension support for version 2,as previously said we will learn with use and second option directs the installation to specified directory.
If there is error regarding libxml2 then install the libxml library which is used to parse xml files as follows:

[sudo apt-get install libxml2-dev]

Step 3:
[make && make install]
Again I am specifying you should have permissions or other wise use sudo .

Now you have to edit certain text files so as to configure php as follows:
Now there are certain ini files in your php-5.3.4 which is source folder of php from where you have configured & installed php using configure and make commands and from which that particular ini file is to be copied to /usr/local/lib and rename it as php.ini.
[ls -l php*] will list files starting with php as follows:

-rw-r--r-- 1 tarun tarun  1489 2011-12-30 00:10 php5.spec
-rw-r----- 1 tarun tarun  1489 2007-09-26 21:14 php5.spec.in
-rw-r----- 1 tarun tarun  2523 2006-03-07 00:40 php.gif
-rw-r----- 1 tarun tarun 68760 2010-12-08 05:23 php.ini-development
-rw-r----- 1 tarun tarun 68990 2010-12-08 05:23 php.ini-production

Here we are interested in php.ini-development file and copy it to /usr/local/lib and rename it to as php.ini
Edit this file with the editor you want whether you are using gedit or nano or vim but the condition is that you should know how it works.[gedit php.ini] after reaching /usr/local/lib.
So search for "include" in that file until you find something like this:

Before Modification-----------

; UNIX: "/path1:/path2"
;include_path = ".:/php/includes"
;
; Windows: "\path1;\path2"
;include_path = ".;c:\php\includes"
;
; PHP's default setting for include_path is ".;/path/to/php/pear"
; http://php.net/include-path

Here lines starting with ; are comments,so according to our requirement we will add this line as follows:

After Modification-----------

; UNIX: "/path1:/path2"
;include_path = ".:/php/includes"
;
#Modified by Tarun_Chawla on 4 jan 2012
include _path ="/home/tarun/apache/php"
; Windows: "\path1;\path2"
;include_path = ".;c:\php\includes"
;
; PHP's default setting for include_path is ".;/path/to/php/pear"
; http://php.net/include-path

Now edit some apache files,move to /home/tarun/apache/conf/ and edit the httpd.conf in this directory.
[gedit httpd.conf]
Search for "php" until you find this line as follows:

# LoadModule foo_module modules/mod_foo.so
LoadModule php5_module        modules/libphp5.so
#

And modify it to :

# LoadModule foo_module modules/mod_foo.so
LoadModule php5_module        /home/tarun/apache/modules/libphp5.so
LoadModule php5_module        modules/libphp5.so
#

Now search for "AddType" until you see this as follows:

# AddType allows you to add to or override the MIME configuration
    # file specified in TypesConfig for specific file types.
    #
    #AddType application/x-gzip .tgz
 
And modify it as follows so that apache recognizes .php and .phps as php files,.phps file when opened with apache will open php source file without compiling this will used for debugging purposes and .php files will be treated as php files and php will interpret them as required.

# AddType allows you to add to or override the MIME configuration
    # file specified in TypesConfig for specific file types.
    #
    #AddType application/x-gzip .tgz
     Addtype application/x-httpd-php .php 
     Addtype application/x-httpd-php-source .phps
    #

There is another section you will have to look through,search for "index" in httpd.conf until you find these lines which follow as:

</Directory>

#
# DirectoryIndex: sets the file that Apache will serve if a directory
# is requested.
#

#
# The following lines prevent .htaccess and .htpasswd files from being 
# viewed by Web clients. 
#
<FilesMatch "^\.ht">
    Order allow,deny
    Deny from all
    Satisfy All
</FilesMatch>

After Modification:

</Directory>

#
# DirectoryIndex: sets the file that Apache will serve if a directory
# is requested.
#
<IfModule dir_module>
    DirectoryIndex index.php index.html
</IfModule>

#
# The following lines prevent .htaccess and .htpasswd files from being 
# viewed by Web clients. 
#
<FilesMatch "^\.ht">
    Order allow,deny
    Deny from all
    Satisfy All
</FilesMatch>

This is done so when your computer is accessed remotely as a server index.html or index.php will serve them according to the order in which you have written the names.
Now save the files and exit.

Start the apache server as:
[sudo /home/tarun/apache/bin/apachectl start] or restart if it is already running as [sudo /home/tarun/apache/bin/apachectl restart].

Now check your server which ready with php support as follows:

make a text file as hello.php in so path will be like this /home/tarun/apache/htdocs/hello.php and paste the following code below in it :

<html>
<head>
<title>
This is our first php script</title>
</head>
<body>
<?php 
phpinfo();
?>  

</body>

</html>

Now go to your browser and run http://localhost/hello.php
It will show the details regarding php installation and version.

If any problem persists write down here I will be pleased to help you.

Monday, December 19, 2011

Setting Environment variable for java in ubuntu/Linux

To set environment variable for java proceed as follows:
Firstly goto oracle website and download java development tool kit which is of .bin extension.
Here I am using jdk-6u23-i586.bin file which is downloaded by me .Copy it onto Desktop,open the terminal and do the folllowing:
tarun@chawla~$cd Desktop
tarun@chawla~/Desktop$sudo chmod +x jdk-6u23-i586.bin
tarun@chawla~/Desktop$./jdk-6u23-i586
A screen shot is given below

After that a directory with some files will be created on your Desktop let call this directory as jdk1.6_23.
Now you have to add the  jdk1.6_23/bin path to PATH enviroment variable as follows.
All executables files are stored in  a directory somewhere which act as a command for you,when you type the file name and press enter it executes.For ex you type mkdir command for making directory,actually mkdir is a executable file stored at some place in directory such as /usr/bin.
Environment Path variable are used to locate commands ,the path for these commands is stored in PATH variable. Now you have to add that jdk/bin path to PATH variable.I have put jdk files on my Desktop so absolute path here will be /home/tarun/Desktop/jdk1.6_23/bin,here tarun is my user name replace it with your username.
Now open the terminal and proceed as follows and this time you are in home directory by typing cd command:
tarun@chawla~$echo $PATH
tarun@chawla~$/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/home/tarun/apache/bin:/home/tarun/apache/man:/usr/local/lib/
tarun@chawla~$gedit .bashrc

.bashrc file will be opened which is a text file,and append following line to the file
PATH=$PATH:/home/tarun/Desktop/jdk1.6_23/bin/:
check your installation by opening terminal again after closing the previous one as follows:
tarun@chawla~$java -version

tarun@chawla~$java version "1.6.0_23"
Java(TM) SE Runtime Environment (build 1.6.0_23-b05)
Java HotSpot(TM) Server VM (build 19.0-b09, mixed mode)
If this comes as output then enjoy programming buddy.

And now save the .bashrc file.One thing can be considered here that you can put jdk1.6_23 folder any where at some other place and modify the path accordingly.

Sunday, December 18, 2011

Playing Restricted formats in ubuntu such as MP3,DAT,MPEG etc

Initially when I installed ubuntu I was unable to play my favourite music because these formats such as mp3,mpeg are restricted if you want to play them you have to install some packages.

Sol 1 is to open the terminal and install vlc as follows as vlc supports all formats I have heared:

tarun@chawla:~$ sudo apt-get update
(skip this if you have already updated)

tarun@chawla:~$sudo apt-get install vlc

After terminal finishes vlc is intsalled,run those music files with vlc.

or installed ubuntu-restricted-extras package which packages most of the plugins and software required to run day to day licensed things.
To install it do as follows:
tarun@chawla:~$ sudo apt-get install ubuntu-restricted-extras
(after updating as above,if you have already updated skip updating).
Enjoy the day

Converting HTML files to PDF in ubuntu Linux

When you have downloaded any book in html then reading that book is cumbersome,
why don't you convert it into pdf.
Here it is:
htmldoc is a software available which supports both gui and terminal operation which converts HTML pages to PDF or PostScript formats as follows.
Reach the termial Applications->Accessories->Terminal.

before installing make sure that you are connected to Internet.
tarun@chawla:~$ sudo apt-get update
(skip this step if you had already  update)
tarun@chawla:~$sudo apt-get install htmldoc                                        
tarun@chawla:~$htmldoc

Initially you will feel some trouble but you will learn with two or three try just use it after all it has a Graphical User Interface(GUI).
Htmldoc

Connecting ubuntu to Internet through a 3G modem with sakis3g script

There are many Data cards or you can say Dongles available in market such as Micromax but ubuntu 10.04 does not recognise it ,this is due to reason that ubuntu thinks it as a memory device not as a modem.
You have to manually switch the dongle to modem. Sakis3g is a script currently available,just search it out on google you will surely get it or download from it here Sakis3g.

After downloading the script you have to make it executable by right clicking on it and in the permissions option make it executable,the option would be below in gnome desktop or do it from terminal as follws:

copy the sakis3g to Desktop and open the terminal through Applications->Accessories->Terminal.
user@ubuntu:~$ cd Desktop
user@ubuntu:~$sudo chmod +x sakis3g                                          //to make script executable
user@ubuntu:~$./sakis3g --config

Make sure that Desktop have a capital D and replace sakis3g by the script name you have downloaded.
Now script will run and click the connect with 3g option let it do the task required,
an if it fails don't leave your seat just try 4-5 times it will run surely if it is a 3g modem.
ubuntuway.blogspot.com