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

Showing posts with label install. Show all posts
Showing posts with label install. 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.

Tuesday, February 14, 2012

Installing firefox-10.0.1.tar.bz2 in ubuntu 10.04/Linux|Installing firefox in linux|Installing latest version of firefox in linux/ubuntu|Installing firefox in ubuntu/linux

Installing firefox is much easier as it is available precompiled archived in .tar.bz2,you don't have to compile and then install it,you just have to download and extract it and run the executable file named as firefox and firefox will be opened for you. Below I have given a simple method to install the latest version of firefox in linux as follows:

1. Download the firefox from http://www.mozilla.org/en-US/firefox/fx.

2. Extract the file using terminal by typing command [tar -xvjf firefox-10.0.1.tar.bz2]. This will extract the contents in the current directory.

3. First method:Now right click on desktop and click on create a launcher and fill the 'type' as 'application',fill in the name as you want,In the command text box browse the path to the firefox file which is in the extracted file and then click on 'ok'. Now click on firefox and your firefox will launch.
     
   Second Method:  Reach to the firefox-10.0.1 directory which is made after
extracting and then type in terminal[./firefox]. This will launch firefox from current directory.
 



Wednesday, February 8, 2012

How to install .bin file in ubuntu linux using terminal

Most of the developments kit are archived in .bin format which are ready to install binary files you just have to make them executable and your OS will interpret them. For example Real player/Adobe reader/Java is available in .bin format.To install proper .bin files proceed as follows and we are assuming the file name as file.bin:
1. Copy the file to Desktop.

2. Open the terminal and reach to desktop as follows:
    [cd Desktop]

3. Make the file executable using chmod,for more details use [man chmod]
    [sudo chmod +x file.bin].

4. [./file.bin]
5. Follow the instructions displayed on terminal.


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]

Tuesday, February 7, 2012

Installing Grub after windows swipe out grub usinglive cd and supergrub

Here we are going to discuss two methods one is recovering from live cd and other is using super grub:
First method:
Boot in your machine from live cd and run the live desktop session using try ubuntu option and do as follows.

This is a simple and quick method to restore grub from live cd.  The terminal is used for entering commands and you must know the partition in which you have installed boot i.e sda1 or sda3 or hda1 like that,if you have not made a different boot partition then you must know your root partition. Now problem starts here because some use does not know the partition name correctly.
Open a terminal by selecting Applications, Accessories, Terminal from the menu bar.
Determine the partition with the Ubuntu installation. The fdisk option "-l" is a lowercase "L". 

[Sudo fdisk -l]
 
If you are not sure of partition then look for small partition you are comfortable for formatting.
 
Now the mount the partition onto /mnt using command below as follows:
 
[sudo mount /dev/sdxn /mnt

here n is replaced by integer "1","2" or "3" etc. and x is replaced by a,b or c etc.
 
Run the grub install command as described below,this will install grub again .
 
[sudo grub-install --root-directory=/mnt   /dev/sdx]

Now reboot and everything seems to be alright.

 Second Method:
 
Super grub disk is used to repair grub and restore original MBR, so that the disk does not get damaged once the Linux partition is formatted. Super Grub can be downloaded for free and then burned to a CD to make a Super Grub disk live CD.The live CD can be used to repair grub by fixing the boot of GNU Linux. The Super Grub disk can be used to restore MBR back to Windows, if the user wishes to leave the GNU Linux OS and install Windows. Before formatting the Linux partition, the Super Grub disk live CD has to be used to restore the original MBR. 

Super Grub Disk is used to repair Grub and the MBR and reinstall on another partition. 
It can also restore the original MBR uninstalling Grub for users wishing to leave GNU/Linux, without risk of making the computer unusable after formatting the Linux partition. 



You can download Super Grub Disk at this address: 
http://download.linux-live-cd.org/Super_Grub_Disk/download/binaries/sgd/cdrom/ 



Select the file. "Iso" the most recent. 
You can also download versions for other media (USB floppy) to this page: http://www.supergrubdisk.org/ 



The Use

As mentioned above, Super Grub Disk can be used to repair grub, either restore the original MBR.
Once the image. "Iso" download, see this tutorial for burning it.


Launch of Super Grub Disk
  • Start your computer from the CD Super Grub Disk.
  • Select "Super Grub Disk" from the list and click OK. Then select the language.
  • Some details are displayed, including an explanation of the main menu in text mode, click OK to continue.



Repair Grub

Sometimes, unfortunately, we should reinstall Windows, unfortunately after installation, Windows is the only system accessible from MBR because it has been rewritten.
  • From the main menu for Super Grub Disk, select "GNU / linux".
  • Then "Fix boot of GNU/linux"
  • A message will indicate that the operation was successful; Super Grub Disk will detect your installation of Linux and reinstalled GRUB on MBR using the configuration file found.

Confirm and return to the main menu by selecting the top of each menu.

  • Choose "Restart PC" to the last screen.


Restore MBR back to Windows

You may decide to leave GNU/Linux, here's how the world of free software will help you anyway in your approach. 

Perform the following before you format the partition GNU/Linux

  • From the main menu for Super Grub Disk, select "Windows".
  • Then select "Fix Windows startup.
  • A message will warn you that rewriting MBR is not a safe operation, the same warnings are given from a recovery CD of Windows when introducing the command to the C:

fixmbr 
fixboot 

NB: 
Despite the excellent free software GNU / Linux, these manipulations are not without risk, as there is not infallible, we prefer to advise you. 
But nothing ventured, nothing gained! Let us continue ... 

to emphasize that there are alternatives to uninstall Grub/Lilo MBR HERE
  • Then select your operating system Windows in the list.
  • Then select the disk in which MBR will be restored.
  • Operations continue after validation and MBR is restored successfully.
  • Navigate to the main menu by following the top of each menu.
  • And restart your PC.


Once the operations have been completed and your computer rebooted, Grub has disappeared leaving a conventional Windows startup.

Friday, January 6, 2012

Removing Broken packges through command line in Ubuntu

Some times broken packages creates problem in installing new software so do the following step to remove the broken packages,some times some packages can't be removed they are upgraded so you need internet connection at that time so make sure that you have internet connection available:

[sudo apt-get clean]

[sudo apt-get install -f]

If you any questions regarding apt-get utility then do as follows:

[man apt-get]

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.

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
ubuntuway.blogspot.com