Set sudoer permission in admin group:
# nano /etc/group
Change/Add admin
*admin: name1, name2, name3
Ctrl X > Y > Enter
Thursday, May 31, 2012
UBUNTU - EDIT SUDOER FILE PERMISSION
UBUNTU: How TO Install MySQL-Server
Case: Ubuntu Server for Moodle Installation
Install MySQL (skip Postgresql)
Install MySQL (skip Postgresql)
sudo apt-get install mysql-server php5-mysql
- Replace the following string NewRootDatabasePassword with a secure password of your own choosing.
There is no space between the -p and the password on the second command.
mysqladmin -u root password NewRootDatabasePassword mysqladmin -u root -h localhost password NewRootDatabasePassword -pNewRootDatabasePassword
- Create the Moodle database and Moodle user in MySQL.
The mysql command will prompt for your NewRootDatabasePassword (from above). Replace NewMoodleDatabasePassword with a secure password of your own choosing.
mysql -u root -p > CREATE DATABASE moodle DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci; > GRANT ALL PRIVILEGES ON moodle.* TO moodleuser@localhost IDENTIFIED BY 'NewMoodleDatabasePassword'; > GRANT SELECT,LOCK TABLES on moodle.* TO moodlebackup@localhost IDENTIFIED BY 'MoodleBackupPassword'; > FLUSH PRIVILEGES; > QUIT
- The above also creates a backup user moodlebackup so that you can use mysqldump to make database backups without incident.
UBUNTU: Add New Hard Disk in Virtual Server
Case: In Unlicensed vmware
1. Power off the server
2. Right Click on server > Edit Setting
3. Add New Hard Disk > Next > Next
4. Disk Size: 25 GB > Case for db server(don't click thin provisioning)
5. Specify Datastore > Datastore01
6. Next > Next > Finish > Ok
** Power on the server back.
How to present/mount New Hard Disk in Ubuntu?
1. To list the HD in server
# fdisk -l
/dev/sdb/ ..........
2. To Format the new Hard Disk# mkfs.ext3 /dev/sdb
# Yes: Y > Enter
# cd /
3. To Mount New HD in Ubuntu Server
# mkdir data && mount /dev/sdb/ /data/
# df -h
4. Configure/edit fstab file
# nano /etc/fstab
**Add line under the last row:(Can also refer to existing ubuntu server)
/dev/sdb /data/ ext3 noatime 0 0
Ctrl X > Y > Enter (to save & exit).
.
1. Power off the server
2. Right Click on server > Edit Setting
3. Add New Hard Disk > Next > Next
4. Disk Size: 25 GB > Case for db server(don't click thin provisioning)
5. Specify Datastore > Datastore01
6. Next > Next > Finish > Ok
** Power on the server back.
How to present/mount New Hard Disk in Ubuntu?
1. To list the HD in server
# fdisk -l
/dev/sdb/ ..........
2. To Format the new Hard Disk# mkfs.ext3 /dev/sdb
# Yes: Y > Enter
# cd /
3. To Mount New HD in Ubuntu Server
# mkdir data && mount /dev/sdb/ /data/
# df -h
4. Configure/edit fstab file
# nano /etc/fstab
**Add line under the last row:(Can also refer to existing ubuntu server)
/dev/sdb /data/ ext3 noatime 0 0
Ctrl X > Y > Enter (to save & exit).
.
Wednesday, May 23, 2012
CodeIgniter: How to check CodeIgniter version.
Open CodeIgniter root file:
# cd /data/form/system/core
# ee CodeIgniter.php
Check the version in this code:
define('CI_VERSION', '2.0')
Monday, May 14, 2012
Drupal: Clean URL Error after migrate to Ubuntu Server
Clean URLs with Apache 2 on Ubuntu
Step 1 - Method A: "Virtual Host" Setup
First, from the Linux command line, enable the rewrite module for apache with this command:
sudo a2enmod rewrite
You can check to see if this worked by running:
apache2ctl -M
and seeing if it is on the list.
Next, use an editor (such as
nano) to edit the appropriate Apache configuration file for your Drupal site in the /etc/apache2/sites-available/ directory. For a single site, the file is /etc/apache2/sites-available/default; if you have multiple sites, the file names should reflect the names of the sites to which they refer. Thus, to edit the default site configuration, usesudo nano /etc/apache2/sites-available/default
Look for the
Directory section referring to the folder where your Drupal site lives (in /etc/apache2/sites-available/default, this is typically ), and change the line:AllowOverride None to AllowOverride All
(This directive permits an .htaccess file, such as Drupal's, to be used to override Apache's default settings, and is necessary to allow the URL rewriting to work. Seehttps://help.ubuntu.com/community/EnablingUseOfApacheHtaccessFiles for more information).
Save this file and then reload Apache as follows:
sudo /etc/init.d/apache2 reload
Subdomain Setup
Instead of creating multiple virtual host files, you can create one virtual host file that uses a wildcard in the ServerAlias. Both a simple multi-site Drupal setup and multiple Drupal versions can run this way, if the different subdomains are defined for each site in settings.php.Consider the following and modify your configuration file to fit your needs.Here is a partial listing of a virtual host configuration file that would support the last two lines in the above example. Note this is not intended to be a COMPLETE configuration file, but rather provide guidance for your development setup.
DocumentRoot "/www/Dr6"
ServerName example
ServerAlias *.dr6.example
AllowOverride All
Edit & save your config file to suit your development needs. Assuming the site is already enabled, then reload Apache.Step 1 - Method B: apache2.conf
In Apache version 2, httpd.conf has been deprecated and the new file is located at:
/etc/apache2/apache2.conf.
Thus, it's no longer necessary to do the following in httpd.conf to enable the rewrite module (mod_rewrite):
LoadModule rewrite_module modules/mod_rewrite.so
AddModule mod_rewrite.c
AddModule mod_rewrite.c
Simply run the following from the Linux command line:
sudo a2enmod rewrite
To disable the module you can run:
(**Note that this would cause clean URLs to break.)
sudo a2dismod rewrite(**Note that this would cause clean URLs to break.)
Once mod_rewrite is enabled, open apache2.conf in a text editor. Note that it will probably be read-only, so you will need sudo privileges to edit it. Use a command such as:
sudo nano /etc/apache2/apache2.conf
Find where the sections are in your apache2.conf and add another one for your Drupal site similar to this:
AllowOverride All
After you edit apache2.conf as listed above, you need to restart the server by:
sudo /etc/init.d/apache2 reload
Step 1 - Method C: Add Rewrite Rules Directly to Virtual Host or apache2.conf
If you do not wish to allow .htaccess overrides, you can add the rewrite rules directly to a virtual host file or apache2.conf. The following should work:
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
This can provide slightly faster server performance since Apache will not look in every directory for an .htaccess file.Note that, for proper security, you will need to add in the rules from the Drupal files directory's .htaccess file as well.More info >> http://drupal.org/node/134439
Labels:
apache setup,
Clean Urls,
drupal,
ubuntu,
vhost setup
Wednesday, May 9, 2012
FreeBSD: Enter full pathname of shell or RETURN for /bin/sh
I got this error after scp a big file yesterday.. I thought my server was crash.
But it actually run in single user shell.
Solution:
Enter full pathname of shell or RETURN for /bin/sh: > Enter
# Exit or ctrl-D to leave the single-user shell.
Then login like usual to your server.
**********Standard way of dealing with single user mode:
But it actually run in single user shell.
Solution:
Enter full pathname of shell or RETURN for /bin/sh: > Enter
# Exit or ctrl-D to leave the single-user shell.
Then login like usual to your server.
**********Standard way of dealing with single user mode:
Code:
fsck -y mount -u / mount -a -t ufs swapon -a
Linux/Ubuntu: How to extract .tgz file
.tgz and tar.gz files are pretty much the same. You extract them like this:
tar -xvzf file.tar.gz
tar -xvzf file.tgz
.
tar -xvzf file.tar.gz
tar -xvzf file.tgz
.
Subscribe to:
Posts (Atom)