RSS

Monthly Archives: May 2015

Auto Mount NTFS after reboot

By Ubuntu

First, you need to find the device locations of the partition(s) you wish to mount. Open a terminal and run:

  • sudo blkid

For illustration purposes, an example output from a computer setup with a Vista/Ubuntu dual-boot and shared NTFS data partition is shown here:

  • /dev/sda1: LABEL="Recovery" UUID="B23613F43613B875" TYPE="ntfs" 
    /dev/sda2: LABEL="Windows" UUID="38CE9483CE943AD8" TYPE="ntfs" 
    /dev/sda3: LABEL="Data" UUID="519CB82E5888AD0F" TYPE="ntfs" 
    /dev/sda5: UUID="00d7d951-2a35-40fd-8e5d-411bb824ff3b" TYPE="swap" 
    /dev/sda6: LABEL="Ubuntu" UUID="6044b1d0-208e-4ab3-850d-03a92e1516fc" TYPE="ext4"

The first three partitions, all NTFS, are the ones that concern us here. There are no FAT32 partitions. In this instance, all three NTFS partitions have partition labels, which makes it easier to identify the purpose of each. If your blkid output does not include partition labels, this means that the partitions do not have labels and you will have to determine which partition you wish to mount by another means. Of the three NTFS partitions, we are going to configure /etc/fstab with only the third, the Data partition. Partition /dev/sda1 is the OEM manufacturer’s recovery partition and should be left unmounted, or as described below. Partition /dev/sda2 is the Windows C:\ partition and is best not included in /etc/fstab for the reasons described above, or mounted read-only – see below.

You will now need to create a mountpoint for each NTFS partition that you wish to mount by means of /etc/fstab. In our illustration we are going to add one entry only for /dev/sda3. From a terminal:

  • sudo mkdir /media/Data

In this case we have created a mountpoint with the same name – Data – as the partition label. You may use (almost) any string you wish.

Before editing /etc/fstab directly, it is a good idea to make a backup. From a terminal:

  • sudo cp /etc/fstab /etc/fstab.orig

Now open /etc/fstab in a text editor with root privileges. In Ubuntu:

  • gksudo gedit /etc/fstab

In Kubuntu:

  • kdesudo kate /etc/fstab

In Xubuntu or Lubuntu:

  • gksudo leafpad /etc/fstab

For a general-purpose read-write mount, add this line to the end of /etc/fstab:

  • UUID=519CB82E5888AD0F  /media/Data  ntfs-3g  defaults,windows_names,locale=en_US.utf8  0 0

Replace the UUID with the one relevant for your partition as shown in your blkid output. “519CB82E5888AD0F” will not work for you.

Also, substitute your mountpoint for “/media/Data”. In case you have a blank space in the name of the mountpoint you want to use like “New Volume” instead of “Data” located in “/media” use “/media/New40Volume”. The space character is created by using “40” in the fstab.

You will also need to change the “locale=en_US.utf8” option to one suitable for your location and language if you are not in the USA. You can determine your locale with this terminal command:

  • locale

Or for a list of all locales available on your system:

  • locale -a

Now save your edited /etc/fstab and close the text editor. The partition(s) you have configured will be mounted the next time you reboot, but to mount them now:

  • sudo mount -a

Copy from: https://help.ubuntu.com/community/MountingWindowsPartitions

Advertisements
 
Leave a comment

Posted by on May 22, 2015 in Linux, Ubuntu

 

Change www path in Apache2 Ubuntu

By: Apache Ubuntu

To create a new site:

  • Copy the default website as a starting point. sudo cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/mysite.conf 

  • Edit the new configuration file in a text editor “sudo nano” on the command line or “gksudo gedit”, for example:gksudo gedit /etc/apache2/sites-available/mysite.conf

  • Change the DocumentRoot to point to the new location. For example, /home/user/public_html/

  • In the file: /etc/apache2/apache2.conf, change the Directory directive, replace <Directory /var/www/> to<Directory /home/user/public_html/>

  • You can also set separate logs for each site. To do this, change the ErrorLog and CustomLog directives. This is optional, but handy if you have many sites

  • Save the file

Now, we must deactivate the old site, and activate our new one. Ubuntu provides two small utilities that take care of this: a2ensite (apache2enablesite) and a2dissite (apache2disable site).

$ sudo a2dissite 000-default && sudo a2ensite mysite

Finally, we restart Apache2:

$ sudo /etc/init.d/apache2 restart

If you have not created /home/user/public_html/, you will receive an warning message

Copy from: https://help.ubuntu.com/community/ApacheMySQLPHP

 
Leave a comment

Posted by on May 22, 2015 in Apache2, Linux, Ubuntu

 

Error 500 and 404 when using .htaccess for removing index.php

By: Sochinda

Enable mod_rewrite in apache

  1. Enable ReWrite mode in Apache2
    $ sudo a2enmod rewrite
    $ sudo service apache2 restart
  2. Edit site-enable configuration
    <Directory /var/www/>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride all
        Order allow,deny
        allow from all
    </Directory>
    
  3. Add .htaccess
    Options +FollowSymLinks
    IndexIgnore */*
    
    <IfModule mod_rewrite.c>
     RewriteEngine on
    
     #RewriteBase /
    
     RewriteCond %{REQUEST_FILENAME} !-f
     RewriteCond %{REQUEST_FILENAME} !-d
    
     RewriteRule ^(.*)\?*$ index.php/$1 [L,QSA]
    
    </IfModule>
  4. Restart Apache2 Service
 
Leave a comment

Posted by on May 19, 2015 in Apache2, Yii