Authentication
Log in as root by issuing the following command
su root
Use SSH to login to LINODE instance. NB if using SSH key
pair authentication mode then username/password authentication is unnecessary as shown below.
Hostname
Set the hostname by issuing the following commands
hostname
hostname -f
Results for issuing hostname command
li501-103
li501-103.members.linode.com
LINODE Login
Login as root in the LINODE instance by issuing the following
commands
su root
Install and Configure the Apache Web Server
Issue the following command to
install Apache:
apt-get install apache2
Now we'll configure virtual
hosting so that we can host multiple domains (or subdomains) with the server.
These websites can be controlled by different users, or by a single user, as
you prefer.
Configure Name-based Virtual Hosts
Issue the
below command
vim /etc/apache2/sites-available/spatialwise_apps.com
Enter the entries below by typing or copying and pressing Shift+CTRL+V
<VirtualHost *:80>
ServerAdmin
waruid@gmail.com
ServerName
example.com
ServerAlias
www.spatialwise_apps.com
DocumentRoot
/srv/www/spatialwise_apps.com/public_html/
ErrorLog
/srv/www/spatialwise_apps.com/logs/error.log
CustomLog
/srv/www/spatialwise_apps.com/logs/access.log combined
</VirtualHost>
Issue the following commands
esc
Type the following commands to save and quit
:wq
Before you can
use the above configuration, you'll need to create the specified directories.
For the above configuration, you can do this with the following commands.
Substitute your own domain names for those shown below.
mkdir -p /srv/www/spatialwise_apps.com/public_html
mkdir /srv/www/spatialwise_apps.com/logs
After you've
set up your virtual hosts, issue the following commands:
a2ensite spatialwise_apps.com
This command
symbolically links your virtual host file from sites-available to
the sites-enabled directory. Finally, before you can access your
sites you must reload Apache with the following command:
service apache2 reload

Install MySQL
The first step
is to install the mysql-server package, which is accomplished by the following
command:

During the
installation you will be prompted for a password. Choose something secure (use
letters, numbers, and non-alphanumeric characters) and record it for future
reference.
Configure MySQL and Set Up Databases
Run the
following command to execute the program:
mysql_secure_installation

Next, you may
create a database and grant your users permissions to use databases. First, log
in to MySQL:
mysql -u root -p
Enter MySQL's
root password, and you'll be presented with a MySQL prompt where you can issue
SQL statements to interact with the database.
To create a
database and grant your users permissions on it, issue the following command.
Note, the semi-colons (;) at the end of the lines are crucial for ending the
commands. Your command should look like this:
create database lollipop;
grant all on lollipop.* to 'foreman' identified by '5t1ck';
flush privileges;
With that
completed, you've successfully configured MySQL and you may now pass these
database credentials on to your users. To exit the MySQL database
administration utility issue the following command:
quit
With Apache
and MySQL installed you are now ready to move on to installing PHP to provide
scripting support for your web pages.
Install and Configure PHP
Ubuntu
includes packages for installing PHP from the terminal. Issue the following
command:
apt-get
install php5 php-pear
Issue the command below and see to it the
settings below are well done.
vim /etc/php5/apache2/php.ini
max_execution_time = 30
memory_limit = 64M
error_reporting = E_COMPILE_ERROR|E_RECOVERABLE_ERROR|E_ERROR|E_CORE_ERROR
display_errors = Off
log_errors = On
error_log = /var/log/php.log
register_globals = Off
After
making changes to the PHP configuration file, restart Apache by issuing the
following command:
service apache2
restart
If you need support for MySQL in PHP, then
you must install the php5-mysql package with the following command:
apt-get install
php5-mysql
To install the php5-suhosin package, which
provides additional security for PHP 5 applications (recommended), issue the
following command:
apt-get install
php5-suhosin
Restart Apache to make sure everything is
loaded correctly:
service apache2
restart
Maintenance Section
Remove PHP
Issue the command below
sudo
apt-get purge php*
Remove apache
Issue the command below
apt-get --purge remove apache2
Remove MySQL
Issue the following commands at the terminal
as root
apt-get --purge remove mysql-server
apt-get --purge remove mysql-client
apt-get --purge remove mysql-common
apt-get --purge remove mysql-client
apt-get --purge remove mysql-common
apt-get autoremove
apt-get autoclean
apt-get autoclean
No comments:
Post a Comment