Sunday, February 5, 2012

Apache manual installation on windows


Manual Installation

Manual installation offers several benefits:
  • backing up, reinstalling, or moving the web server can be achieved in seconds (see 8 Tips for Surviving PC Failure)
  • you have more control over how and when Apache starts
  • you can install Apache anywhere, such as a portable USB drive (useful for client demonstrations).
Step 1: configure IIS, Skype and other software (optional)
If you have a Professional or Server version of Windows, you may already have IIS installed. If you would prefer Apache, either remove IIS as a Windows component or disable its services.
Apache listens for requests on TCP/IP port 80. The default installation of Skype also listens on this port and will cause conflicts. To switch it off, start Skype and choose Tools > Options > Advanced > Connection. Ensure you untick “Use port 80 and 443 as alternatives for incoming connections”.
Step 2: download the files
We are going to use the unofficial Windows binary from Apache Lounge. This version has performance and stability improvements over the official Apache distribution, although I am yet to notice a significant difference. However, it is provided as a manually installable ZIP file from www.apachelounge.com/download/
You should also download and install the Windows C++ runtime from Microsoft.com. You may have this installed already, but there is no harm installing it again.
As always, remember to virus scan all downloads.
Step 2: extract the files
We will install Apache in C:\Apache2, so extract the ZIP file to the root of the C: drive.
Apache can be installed anywhere on your system, but you will need to change the configuration file paths accordingly…
Step 3: configure Apache
Apache is configured with the text file \conf\httpd.conf contained in the Apache folder. Open it with your favourite text editor.
Note that all file path settings use a ‘/’ forward-slash rather than the Windows backslash. If you installed Apache anywhere other than C:\Apache2, now is a good time to search and replace all references to “c:/Apache2″.
There are several lines you should change for your production environment:
Line 46, listen to all requests on port 80:
  1. Listen *:80  
Line 116, enable mod-rewrite by removing the # (optional, but useful):
  1. LoadModule rewrite_module modules/mod_rewrite.so  
Line 172, specify the server domain name:
  1. ServerName localhost:80  
Line 224, allow .htaccess overrides:
  1. AllowOverride All  
Step 4: change the web page root (optional)
By default, Apache return files found in its htdocs folder. I would recommend using a folder on an another drive or partition to make backups and re-installation easier. For the purposes of this example, we will create a folder called D:\WebPages and change httpd.conf accordingly:
Line 179, set the root:
  1. DocumentRoot "D:/WebPages"  
and line 204:
  1. <Directory "D:/WebPages">  
Step 5: test your installation
Your Apache configuration can now be tested. Open a command box (Start > Run > cmd) and enter:
  1. cd \Apache2\bin  
  2. httpd -t  
Correct any httpd.conf configuration errors and retest until none appear.
Step 6: install Apache as a Windows service
The easiest way to start Apache is to add it as a Windows service. From a command prompt, enter:
  1. cd \Apache2\bin  
  2. httpd -k install  
Open the Control Panel, Administrative Tools, then Services and double-click Apache2.2. Set the Startup type to “Automatic” to ensure Apache starts every time you boot your PC.
Alternatively, set the Startup type to “Manual” and launch Apache whenever you choose using the command “net start Apache2.2″.
Step 7: test the web server
Create a file named index.html in Apache’s web page root (either htdocs or D:\WebPages) and add a little HTML code:
  1. <html>  
  2. <head><title>testing Apache</title></head>  
  3. <body><p>Apache is working!</p></body>  
  4. </html>  
Ensure Apache has started successfully, open a web browser and enter the address http://localhost/. If all goes well, your test page should appear.

In general, most problems will be caused by an incorrect setting in the httpd.conf configuration file. Refer to the Apache documentation if you require further information.

Rererence:
http://www.sitepoint.com/how-to-install-apache-on-windows/​

Mysql manual installation on windows


Manual Installation

Manual installation offers several benefits:
  • backing up, reinstalling, or moving databases can be achieved in seconds (see 8 Tips for Surviving PC Failure)
  • you have more control over how and when MySQL starts
  • you can install MySQL anywhere, such as a portable USB drive (useful for client demonstrations).
Step 1: download MySQL
Download MySQL from dev.mysql.com/downloads/. Follow MySQL Community ServerWindows and download the “Without installer” version.
As always, virus scan the file and check the its MD5 checksum using a tool such as fsum.
Step 2: extract the files
We will install MySQL to C:\mysql, so extract the ZIP to your C: drive and rename the folder from “mysql-x.x.xx-win32″ to “mysql”.
MySQL can be installed anywhere on your system. If you want a lightweight installation, you can remove every sub-folder except for bin, data, scripts and share.
Step 3: move the data folder (optional)
I recommend placing the data folder on another drive or partition to make backups and re-installation easier. For the purposes of this example, we will create a folder called D:\MySQLdata and move the contents of C:\mysql\data into it.
You should now have two folders, D:\MySQLdata\mysql and D:\MySQLdata\test. The original C:\mysql\data folder can be removed.
Step 4: create a configuration file
MySQL provides several configuration methods but, in general, it is easiest to to create a my.ini file in the mysql folder. There are hundreds of options to tweak MySQL to your exact requirements, but the simplest my.ini file is:
  1. [mysqld]  
  2. # installation directory  
  3. basedir="C:/mysql/"  
  4. # data directory  
  5. datadir="D:/MySQLdata/"  
(Remember to change these folder locations if you have installed MySQL or the data folder elsewhere.)
Step 5: test your installation
The MySQL server is started by running C:\mysql\bin\mysqld.exe. Open a command box (Start > Run > cmd) and enter the following commands:
  1. cd \mysql\bin  
  2. mysqld  
This will start the MySQL server which listens for requests on localhost port 3306. You can now start the MySQL command line tool and connect to the database. Open another command box and enter:
  1. cd \mysql\bin  
  2. mysql -u root  
This will show a welcome message and the mysql> prompt. Enter “show databases;” to view a list of the pre-defined databases.
Step 6: change the root password
The MySQL root user is an all-powerful account that can create and destroy databases. If you are on a shared network, it is advisable to change the default (blank) password. From the mysql> prompt, enter:
  1. UPDATE mysql.user SET password=PASSWORD("my-new-password"WHERE User='root';  
  2. FLUSH PRIVILEGES;  
You will be prompted for the password the next time you start the MySQL command line.
Enter “exit” at the mysql> prompt to stop the command line client. You should now shut down MySQL with the following command:
  1. mysqladmin.exe -u root shutdown  
Step 7: Install MySQL as a Windows service
The easiest way to start MySQL is to add it as a Windows service. From a command prompt, enter:
  1. cd \mysql\bin  
  2. mysqld --install  
Open the Control Panel, Administrative Tools, then Services and double-click MySQL. Set the Startup type to “Automatic” to ensure MySQL starts every time you boot your PC.
Alternatively, set the Startup type to “Manual” and launch MySQL whenever you choose using the command “net start mysql”.
MySQL service 
Note that the Windows service can be removed using:
  1. cd \mysql\bin  
  2. mysqld --remove  
​Reference:
http://www.sitepoint.com/how-to-install-mysql/​