How To Setup A Web-Server in fedora/Ubuntu

This is the first self-help guide to configure your web server in an Ubuntu/fedora. Only the very basic and initial server config will be dealt in this post.Subsequent post will have the advanced stuffs.

First inorder to configure your system to act as a web-server, the best and most favourable thing u can do is that you install the server installation repos initially.If you are installing fedora from a dvd, they give you four options and you should select the server option.So that your OS is already optimized to be a server.And don’t worry it will be having all the stuff you need in a graphical desktop.

Here are the steps you need to follow once you are connected to an internet connection with decent speed.

Any server in Linux is based on LAMP.

Its works as good as any xampp server you have used in Windows.Though you need to have some basic understanding of permissions in Linux.

To install MySQL5, you need to do this:
yum install mysql mysql-server

Then we create the system startup links for MySQL (so that MySQL starts automatically whenever the system boots) and start the MySQL server:

chkconfig –levels 235 mysqld on

/etc/init.d/mysqld start
Run
mysql_secure_installation
to set a password for the user root (otherwise anybody can access your MySQL database!):
[root@server1~]# mysql_secure_installation

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL

SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!

In order to log into MySQL to secure it, we’ll need the current

password for the root user. If you’ve just installed MySQL, and

you haven’t set the root password yet, the password will be blank,

so you should just press enter here.

Enter current password for root (enter for none): <– ENTER

OK, successfully used password, moving on…

Setting the root password ensures that nobody can log into the MySQL

root user without the proper authorisation.

Set root password? [Y/n] <– ENTER

New password: <– yourrootsqlpassword

Re-enter new password: <– yourrootsqlpassword

Password updated successfully!

Reloading privilege tables..

… Success!

By default, a MySQL installation has an anonymous user, allowing anyone

to log into MySQL without having to have a user account created for

them. This is intended only for testing, and to make the installation

go a bit smoother. You should remove them before moving into a

production environment.

Remove anonymous users? [Y/n] <– ENTER

… Success!

Normally, root should only be allowed to connect from ‘localhost’. This

ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] <– ENTER

… Success!

By default, MySQL comes with a database named ‘test’ that anyone can

access. This is also intended only for testing, and should be removed

before moving into a production environment.

Remove test database and access to it? [Y/n] <– ENTER

– Dropping test database…

… Success!

– Removing privileges on test database…

… Success!

This is the first self-help guide to configure your web server in an Ubuntu/fedora. Only the very basic and initial server config will be dealt in this post.Subsequent post will have the advanced stuffs.

First inorder to configure your system to act as a web-server, the best and most favourable thing u can do is that you install the server installation repos initially.If you are installing fedora from a dvd, they give you four options and you should select the server option.So that your OS is already optimized to be a server.And don’t worry it will be having all the stuff you need in a graphical desktop.

Here are the steps you need to follow once you are connected to an internet connection with decent speed.

Any server in Linux is based on LAMP.

Its works as good as any xampp server you have used in Windows.Though you need to have some basic understanding of permissions in Linux.

To install MySQL5, you need to do this:
yum install mysql mysql-server

Then we create the system startup links for MySQL (so that MySQL starts automatically whenever the system boots) and start the MySQL server:

chkconfig –levels 235 mysqld on

/etc/init.d/mysqld start
Run
mysql_secure_installation
to set a password for the user root (otherwise anybody can access your MySQL database!):
[root@server1~]# mysql_secure_installation

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL

SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!

In order to log into MySQL to secure it, we’ll need the current

password for the root user. If you’ve just installed MySQL, and

you haven’t set the root password yet, the password will be blank,

so you should just press enter here.

Enter current password for root (enter for none): <– ENTER

OK, successfully used password, moving on…

Setting the root password ensures that nobody can log into the MySQL

root user without the proper authorisation.

Set root password? [Y/n] <– ENTER

New password: <– yourrootsqlpassword

Re-enter new password: <– yourrootsqlpassword

Password updated successfully!

Reloading privilege tables..

… Success!

By default, a MySQL installation has an anonymous user, allowing anyone

to log into MySQL without having to have a user account created for

them. This is intended only for testing, and to make the installation

go a bit smoother. You should remove them before moving into a

production environment.

Remove anonymous users? [Y/n] <– ENTER

… Success!

Normally, root should only be allowed to connect from ‘localhost’. This

ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] <– ENTER

… Success!

By default, MySQL comes with a database named ‘test’ that anyone can

access. This is also intended only for testing, and should be removed

before moving into a production environment.

Remove test database and access to it? [Y/n] <– ENTER

– Dropping test database…

… Success!

Reloading the privilege tables will ensure that all changes made so far

will take effect immediately.

Reload privilege tables now? [Y/n] <– ENTER

… Success!

Cleaning up…

All done! If you’ve completed all of the above steps, your MySQL

installation should now be secure.

Thanks for using MySQL!

[root@server1~]#

Since you have installed the server edition,Apacche will be installed by default,if not install using following commands.( Yum install httpd or Sudo apt-get install httpd)
Also u need to add install apache too.To do so you need to type these in terminal

yum install httpd

then if u want your system to start this service at startup you need to type this.

chkconfig –levels 235 httpd on

and you can start apache by

service httpd start or /etc/init.d/httpd start

To install PHP5 you need to type

yum install php

and then restart the server by service httpd restart

To get Mysql support in PHP5 you need to type

yum search php and then

yum install php-mysql php-gd php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc php-eaccelerator php-magickwand php-magpierss php-mbstring php-mcrypt php-mssql php-shout php-snmp php-soap php-tid

And then again restart the apache2.

Now to install PHPMyadmin

You need to use these commands

yum install phpmyadmin and then we need to configure phpmyadmin to accept connections from other than localhost for that you can

use either vi /etc/httpd/conf.d/phpMyAdmin.conf or gedit /etc/httpd/conf.d/phpMyAdmin.conf or nano etc/httpd/conf.d/phpMyAdmin.conf

Now all u need to do is to comment out out the stanza):

Once you are done with this you are good to go.Now go into terminal,Login as root and type init 6 so as to restart your computer so as changes takes effect

and then you do the following steps.

Check out whether the apache and mysql are running or not by typing

service httpd status and service mysql status.

If the are running go to your browser and type localhost /127.0.0.1

you would see you server running as u can get a apache page.

Now you can put your site files or wordpress/joomla/drupal cms in /etc/html/www

and follow the installation steps.

Note: you need to be root to do most of the steps. ubuntu user can replace yum with sudo apt-get in all these commands.

Once you have experience in all these stuffs you can install using a single line.But here this is elaborated and detailed so that you may understand the components you have installed.

Any problems if any can be posted .

Advertisements

2 comments

  1. […] How To Setup A Web-Server in fedora/Ubuntu (gotchacode.wordpress.com) […]

  2. […] How To Setup A Web-Server in fedora/Ubuntu (gotchacode.wordpress.com) […]

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: