Showing posts with label server. Show all posts
Showing posts with label server. Show all posts

4/03/2013

Install Linux with Nginx, PHP5 (And PHP-FPM) And MySQL Support On CentOS (Part 2)

After doing the Part 1 article, now I continue installing and configuring other server softwares.

2. Install Nginx.

What is Nginx? Nginx (pronounced "engine x") is a free, open-source, high-performance HTTP server. Nginx is known for its stability, rich feature set, simple configuration, and low resource consumption.

I already add the additional repo in Part 1 to install Nginx.
yum install nginx
then create start up link and start it
chkconfig --levels 235 nginx on
/etc/init.d/nginx start
make confirmation of Nginx installation by typing server IP address (192.168.0.121) or hostname into my browser, and I got Nginx welcome page. Thats all for installing Nginx :)

3. Install PHP5

Nginx need PHP-FPM to work with PHP5. PHP-FPM (PHP-FPM (FastCGI Process Manager) is an alternative PHP FastCGI implementation with some additional features useful for sites of any size, especially busier sites). I install php-fpm together with php-cli and some PHP5 modules like php-mysql which I need to use MySQL from PHP.
yum install php-fpm php-cli php-mysql php-gd php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc php-magickwand php-magpierss php-mbstring php-mcrypt php-mssql php-shout php-snmp php-soap php-tidy
I also install APC, a free and open PHP opcode cacher for caching and optimizing PHP intermediate code. It's similar to other PHP opcode cachers, such as eAccelerator and Xcache. It is strongly recommended to have one of these installed to speed up PHP page.
yum install php-pecl-apc 
Open /etc/php.ini find and set cgi.fix_pathinfo=0:
 /etc/php.ini
I look in my system time zone and then set the same value in date.timezone in /etc/php.ini to avoid error in php error log.
cat /etc/sysconfig/clock
Create the system startup links for php-fpm and start it
chkconfig --levels 235 php-fpm on
/etc/init.d/php-fpm start
PHP-FPM is a daemon process (with the init script /etc/init.d/php-fpm) that runs a FastCGI server on port 9000. 

End of Part 2 

4/02/2013

Install Linux with Nginx, PHP5 (And PHP-FPM) And MySQL Support On CentOS (Part 1)

I want to save my documentation on my web server installation, I use centos server and configure it with nginx, PHP5, php-fpm, and mysql.

First of all, I use the hostname server1.mylocal.com with the IP address 192.168.0.121

Now we begin.
First I need to enable additional repo because php-fpm is not available from the official CentOS repositories, but from the Remi RPM repository which itself depends on the EPEL repository; I enable both repositories as follows:
rpm --import https://fedoraproject.org/static/0608B895.txt
rpm -ivh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
rpm --import http://rpms.famillecollet.com/RPM-GPG-KEY-remi
rpm -ivh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
yum install yum-priorities
Edit the /etc/yum.repos.d/epel.repo and add priority=10 to the epel section.
Edit the /etc/yum.repos.d/remi.repo, and add  priority=10 to the remi section, and change to enable=1

Now we're ready to install the softwares.

1. Install MySQL 5
yum install mysql mysql-server
first thing to do after installing a server software is to create a system startup link, so that MySQL starts automatically whenever the system boots.
chkconfig --levels 235 mysqld on
/etc/init.d/mysqld start
check /etc/my.cnf and make sure the option skip-networking is commented out (not having # mark in front of the line), then restart mysql
/etc/init.d/mysqld restart
then run MySQL setup configuration to setup MySQL root password:

[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!

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 ~]#

End of part 1

7/31/2009

NIC problem in Ubuntu 8.10 Installation

Being a newbie in Linux is pretty challanging. So far I've managed to install 3 webservers and they still running pretty well if I may add :-)
Last week I have my first experience to troubleshoot NIC problem in Ubuntu 8.10 Server installation on my old computer. Its an Intel PIII 800 with 384 RAM, pretty old PC, heh?!

My intention was to build a gateway with Firewall, DNS and DHCP server inside. I'm aware there are many Linux distro that already build to meet my purpose, but since I am a linux newbie, I would like to learn from the basic.

After successfully installed the Ubuntu 8.10 server 2 weeks ago, I left the server untouch for a couple of days becoz of other more urgent matter. When I got back to config the server I realized that the NIC is not functioning. I checked the cable ... It was OK, then check the ifconfig output, it seems OK too, there is eth0 in the list. My thought was maybe the driver was not the right one, then I googling on how to reinstall the NIC driver. I tried several solutions but the problem consist. After some restart, I catch a boot problem concerning the ACPI driver, then my googling change to find out about those ACPI & IRQ problems.

It turned out I have to modified the grub boot loader to disable the ACPI on the Kernel

Change Boot Options Permanently On An Existing Installation
These instructions only apply to systems that use Grub - Ubuntu's default boot loader.

In order to permanently change boot options, you'll need to edit the /boot/grub/menu.lst file.

Before begin, back up the file with a copy that has the current date and time appended to its name:

sudo cp /boot/grub/menu.lst /boot/grub/menu.lst.`date +~%b-%d-%Y~%T`

If the system or /boot partition has changed and the user suspects the partition is not correctly identified by Grub, run this command to obtain a list of partition UUIDs. Note the system or /boot UUID and compare it to the entry on the kernel's UUID line once the kernel menu is opened:

sudo blkid

Then edit the menu.lst file:

sudo nano /boot/grub/menu.lst

(You can edit this file with any text editor, doesn't have to be nano) Use your arrow keys to move your cursor to the line that starts with "# kopt=".

Add or subtract whichever boot option(s) you'd like to add to the end of the boot command, with a space between each one. (See Kernel Options below)

Save the file.

For nano:
Press the Ctrl and o (this is the letter o) keys at the same time. Verify that the filename is correct (edit the filename if it's not) and press the ENTER key to save the file.

Press the Ctrl and x keys at the same time to exit the editor.

Type this command to update the menu entries in the system:


sudo update-grub

The command may present a message indicating that a new configuration file available: "Do you want to keep the existing one for menu.lst". Select Use Package Version. If you select to keep the user modified version, your changes to kopt won't be applied to existing boot options.

Note: If you edit the menu entries directly from Grub and not with a text editor your changes will disappear the next time update-grub is run, for instance or when the kernel or grub packages are updated.



Kernel Options
Note: These options are used by the kernel, and will apply to any installation at any time. The file "Documentation/kernel-parameters.txt" in the relevant linux-source package provides more information.


Options:

vga=xxx
Set your framebuffer resolution to VESA mode xxx. Check here for a list of possible modes.



acpi=off OR noacpi
This parameter disables the whole ACPI system. This may prove very useful, for example, if your computer does not support ACPI or if you think the ACPI implementation might cause some problems (for instance random reboots or system lockups).



acpi=force
Activates the ACPI system even if your computer BIOS date is older than 2000. This parameter overwrites acpi=off and can also be used with current hardware if the ACPI support is not activated despite apm=off.



pci=noacpi OR acpi=noirq
These parameters disable the PCI IRQ routing



pci=acpi
This parameter activates the PCI IRQ routing



acpi_irq_balance
ACPI is allowed to use PIC interrupts to minimize the common use of IRQs.



acpi_irq_nobalance
ACPI is not allowed to use PIC interrupts.



acpi=oldboot
Deactivates the ACPI system almost completely; only the components required for the boot process will be used.



acpi=ht
Impact Deactivates the ACPI system almost completely; only the components required for hyper threading will be used.



noapic
Disable the "Advanced Programmable Interrupt Controller (APIC)".



nolapic
Disable the "local APIC".



apm=off OR noapm
Disable the Advanced Power Management.



irqpoll
Changes the way the kernel handles interrupt calls (set it to polling). Can be useful in case of hardware interrupt issues.

There ... after restart my NIC work like it should be, I can run an update
Next step, configure and install softwares ... :-)

7/29/2008

Install eAccelerator on Centos 5.2

Still on pursuing to make a fast httpd server, I found eAccelerator at techiecorner.com. Here is what I gathered to install the eAccelerator on my Centos 5.2.

First lookup the latest PHP eAccelerator source distribution from here.
My downloaded version is eaccelerator-0.9.5.2.tar.bz2
Then:

$ tar -jxvf eaccelerator-0.9.5.2.tar.bz2
$ cd eaccelerator-0.9.5.2
$ phpize
$ ./configure
$ make
$ make install
after the last command, it shows this line:
Installing shared extensions: /usr/lib/php/modules/

Now we edit php.ini
$ nano /etc/php.ini
and add these line:

extension="eaccelerator.so"
eaccelerator.shm_size=”16″
eaccelerator.cache_dir=”/tmp/eaccelerator”
eaccelerator.enable=”1″
eaccelerator.optimizer=”1″
eaccelerator.check_mtime=”1″
eaccelerator.debug=”0″
eaccelerator.filter=”"
eaccelerator.shm_max=”0″
eaccelerator.shm_ttl=”0″
eaccelerator.shm_prune_period=”0″
eaccelerator.shm_only=”0″
eaccelerator.compress=”1″
eaccelerator.compress_level=”9″

after saving the php.ini, I created temp folder for the eaccelerator

$ mkdir /tmp/eaccelerator
$ chmod 777 /tmp/eaccelerator

then restart the httpd:

$ httpd -k restart

to manage eAccelerator, I copied control.php
cp /usr/src/eaccelerator-0.9.5.2/control.php /path/to/my/homepage/control.php
when I tried to browse http://comp1/control.php, it asked for password, the default is :

Username : admin
Password : eAccelerator

but then I got "This script isn't in the allowed_admin_path setting" error in some area of the page. After took a peak on my ubuntu server configuration that already running eAccelerator, I added "eaccelerator.allowed_admin_path="/path/to/my/homepage"" so my php.ini now look like this :

extension="eaccelerator.so"
eaccelerator.shm_size="16"
eaccelerator.cache_dir="/tmp/eaccelerator"
eaccelerator.enable="1"
eaccelerator.optimizer="1"
eaccelerator.check_mtime="1"
eaccelerator.debug="0"
eaccelerator.filter=""
eaccelerator.shm_max="0"
eaccelerator.shm_ttl="0"
eaccelerator.shm_prune_period="0"
eaccelerator.shm_only="0"
eaccelerator.compress="1"
eaccelerator.compress_level="9"
eaccelerator.allowed_admin_path="/path/to/my/homepage"


save the php.ini, then restart the httpd:

$ httpd -k restart

now I can login and manage the eAccelerator

Install PHP-MemCache On CentOS 5.2

I'm a linux newbie, but I want to speed up my webserver access, after googling around for days, I decided to try the php-memcache and I find most of my installation steps ini howtoforge.com. Here is what I did :

Install rpmforge repo
$ wget
http://dag.wieers.com/rpm/packages/rpmforge-release/rpmforge-release-*.rpm
$ rpm --install rpmforge-release-*.rpm

Install memcached:
$ yum install --enablerepo=rpmforge memcached
test if memcached is running:
$ memcached -m 512 -u nobody -vv

start up the memcached daemon on as many spare machines as you have. The daemon has no configuration file, just a few command line options, only 3 or 4 of which you'll likely use:
$ ./memcached -d -m 2048 -l 10.0.0.40 -p 11211 -u nobody

This starts memcached up as a daemon, using 2GB of memory, and listening on IP 10.0.0.40, port 11211. The -m switch specifies the amount of memory in megabytes. The -l switch specifies the IP to listen on and finally the -p switch specifies the port to listen on. The default port is 11211 and if your machine has just 1 IP you can omit the -l parameter.

Install PHP MemCache extension
$ cd /usr/src/
$ wget http://pecl.php.net/get/memcache-2.2.3.tgz
$ tar -xvf memcache-2.2.3.tgzcd memcache-2.2.3
$ phpize && ./configure --enable-memcache && make
Copy the file memcache.so to the default module directory.
$ cp /usr/src/memcache-2.2.3/modules/memcache.so
/usr/lib/php/modules/memcache.so

Edit php.ini
$ nano /etc/php.ini
And add this line ini php.ini
extension=memcache.so
Restart Apache2
$ /etc/init.d/httpd restart
Now the php-memcache is installed

7/16/2008

Computer Cluster

A computer cluster is a group of linked computers, working together closely so that in many respects they form a single computer. The components of a cluster are commonly, but not always, connected to each other through fast local area networks. Clusters are usually deployed to improve performance and/or availability over that provided by a single computer, while typically being much more cost-effective than single computers of comparable speed or availability.



Cluster types:
High-availability (HA) clusters
High-availability clusters (also known as failover clusters) are implemented primarily for the purpose of improving the availability of services which the cluster provides. They operate by having redundant nodes, which are then used to provide service when system components fail. The most common size for an HA cluster is two nodes, which is the minimum requirement to provide redundancy. HA cluster implementations attempt to manage the redundancy inherent in a cluster to eliminate single points of failure.

Load-balancing clusters
Load-balancing clusters operate by distributing a workload evenly over multiple back end nodes. Typically the cluster will be configured with multiple redundant load-balancing front ends.

Grid computing
Grid computing or grid clusters are a technology closely related to cluster computing. The key differences (by definitions which distinguish the two at all) between grids and traditional clusters are that grids connect collections of computers which do not fully trust each other, or which are geographically dispersed. (The term GRID to denote a distributed computing and storage environment was coined in 1998 by Ian Foster and Carl Kesselman. It refers to the metaphor of the power grid: computing capacity from a wall outlet and no need to install and maintain complex IT infrastructures on every location that needs access to applications.) Grids are thus more like a computing utility than like a single computer. In addition, grids typically support more heterogeneous collections than are commonly supported in clusters.


Source : wikipedia