วันศุกร์ที่ 17 ธันวาคม พ.ศ. 2553

Make Drupal in Ubuntu Make easy

Installing a web server is very easy in Ubuntu, just enter a few lines in the terminal, without having to install and configure each part of a LAMP (Linux-Apache-MySQL-PHP) installation individually. You can also install other programs this way. The downside is that all components are installed automatically, and not reviewed by you. But as long as you only use the web server locally (localhost or 127.0.0.1), and don't open up for access from the Internet, it should be safe.

Install Ubuntu and LAMP web server

First, install Ubuntu, if you haven't already. There is a good guide over at HowtoForge Just follow the guide ("The Perfect Desktop - Ubuntu 10.04" is the latest), do the update on page 3, and then return here.
To install a LAMP web server, enter this in a terminal and enter your password:
sudo tasksel install lamp-server
After a while the installation process will prompt you for a password for the MySQL server. Make sure that the CAPS Lock button is not activated! If all goes well, the installation will return to the terminal, and the web server is installed. Test this by going to your browser and enter http://localhost/ in the address bar. If the installation was successful, you will see an "It works!" message.

Update php.ini - allow big files, avoid memory issues

To allow importing large sql dumps through phpmyadmin, and avoiding time outs during demanding requests, it is also necessary to update the php.ini file of the Apache server. To open up the php.ini in gedit, enter this in your terminal:
gksudo gedit /etc/php5/apache2/php.ini
...and update the values five places, where it says:
max_execution_time = 120
max_input_time = 90
memory_limit = 96M
post_max_size = 150M
upload_max_filesize = 150M
session.gc_maxlifetime = 14400

Fix Apache Error "Could not reliably determine the server’s fully qualified domain name, using 127.0.1.1 for ServerName"

Open the httpd.conf file:
sudo gedit /etc/apache2/httpd.conf
The httpd.conf file is blank, so add the following to the file, and then save it:
ServerName localhost

Create a MySQL database

To create a database in the MySQL database, log in to the MySQL shell:
mysql -u root -p
Create a database, for a Drupal installation in this example, type in the MySQL shell:
CREATE DATABASE drupal;
and leave the shell:
quit
If you typed in the password(in this example, "ROOT") accidentally with caps lock on, this is how you change it to something safer. "root" is NOT recommended as password. From the terminal:
mysqladmin -u root -p'ROOT' password 'yournewpassword'

Install phpmyadmin

You can also create and administer your MySQL databases through phpmyadmin:
sudo apt-get install phpmyadmin

Install and enable mod_rewrite

Install mod_rewrite, to get nice URL's:
sudo a2enmod rewrite
Enable mod_rewrite:
gksudo gedit /etc/apache2/sites-available/default
...and change "AllowOverride None" to "AllowOverride All", around line 11:
<Directory /var/www/\>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Restart the Apache web server:
sudo /etc/init.d/apache2 restart

Install Drupal

First, to make things easier, start nautilus up with this command:
gksudo nautilus
...and navigate to the /var folder, right-click on the www folder, click 'Permissions' and set owner and group to your own user name. This will prevent problems with automatically created folders in the future.
Download and extract the latest version of Drupal from http://drupal.org/, move it to /var/www/ where the web sites of the Apache web server reside. Also create three folders here, like this:
/var/www/drupal/sites/all/modules
/var/www/drupal/sites/all/themes
/var/www/drupal/sites/default/files (right-click, select 'Properties' -> 'Permissions' and set 'Others' to 'Create and delete files')
Go to /var/www/drupal/sites/default/, make a copy of default.settings.php, call it settings.php file, open it and update database login information around line 92:
$db_url = 'mysqli://root:yourpassword@localhost/drupal';
NOTE: Add an exception in Firefox, if you have disabled "Accept cookies from sites" and unblock the new site if you have a script blocker activated in your browser.
If all went well, you should now be able to enter http://localhost/drupal/install.php and install Drupal.

Install PHP APC, to speed up the server

On Ubuntu 10.04 Lucid:
sudo apt-get install php-apc
sudo /etc/init.d/apache2 restart
On Ubuntu 9.10 Karmic:
Install apache2-threaded-dev:
sudo apt-get install apache2-threaded-dev
Install APC:
sudo pecl install apc
then:
gksudo gedit /etc/php5/apache2/php.ini
...and paste in the file:
extension=apc.so
and save it.
Restart the Apache web server:
sudo /etc/init.d/apache2 restart
Place a file called info.php in /var/www -- containing:
<?php phpinfo(); ?>
Visit http://localhost/info.php, and verify that APC is enabled.

Setting up a virtual host

To set up a virtual host, allowing you to enter just http://drupal/ in stead of http://localhost/drupal/:
sudo gedit /etc/hosts
...and add:
127.0.0.1 drupal
To define where the Apache web server should be looking for the files:
gksudo gedit /etc/apache2/httpd.conf
...and add:
<VirtualHost *:80>
DocumentRoot /var/www/drupal
ServerName drupal
</VirtualHost>
As always, when you change the set up of the Apache server, restart it:
sudo /etc/init.d/apache2 restart

Install Drush

With Drush you can install modules and update Drupal from the command-line: http://drupal.org/project/drush
wget http://ftp.drupal.org/files/projects/drush-6.x-3.3.tar.gz
tar xvzf drush-6.x-3.3.tar.gz
sudo chmod 555 drush/drush
sudo chown -R root:root drush
sudo mv drush /usr/local/
sudo ln -s /usr/local/drush/drush /usr/local/bin/drush
sudo drush dl drush_make
If you get an "exec: 53: php: not found" error after running the last line ("sudo drush dl drush_make") you might have to install the PHP command line interface, with

sudo apt-get install php5-cli
From: http://groups.drupal.org/node/70268

Extra: Programs and fonts to install after Ubuntu installation

You can install programs very easily in Drupal, from the command line. These are some nice programs to install after an Ubuntu install, copy and paste in the terminal:
sudo apt-get install audacious dia epiphany-browser filezilla gparted gqview k9copy klinkstatus lm-sensors sensors-applet macchanger meld regexxer thunar thunderbird unetbootin unrar vim-gnome vlc
Install Multimedia Codecs:
To play file types, like mp3, avi and mov, you need to install some extra tools and codecs. To install them, paste in the terminal:
sudo apt-get install ubuntu-restricted-extras
After that, go to Applications > Add/Remove..., select Show: "All available applications", search for "gstreamer" and install them.
For a more thorough walk through of how to set up a fresh Ubuntu installation: The Perfect Desktop - Ubuntu 9.10 (Karmic Koala)
Audio CD Extractor (Sound Juicer) settings:
Edit > Preferences > Output Format: Edit Profiles > New
Profile Name: CD Quality, better
Gstreamer Pipeline: audio/x-raw-float,rate=44100,channels=2 ! vorbisenc name=enc quality=0.6 ! oggmux
File extension: ogg
Install fonts:
sudo apt-get install ttf-sil-gentium ttf-dustin ttf-georgewilliams ttf-sjfonts sun-java6-fonts ttf-larabie-deco ttf-larabie-straight ttf-larabie-uncommon
Enable firewall and open up port for Transmission:
sudo ufw enable
...and
sudo ufw allow 53484

ไม่มีความคิดเห็น:

แสดงความคิดเห็น