My status

My backup memory
Hiển thị các bài đăng có nhãn Ubuntu. Hiển thị tất cả bài đăng
Hiển thị các bài đăng có nhãn Ubuntu. Hiển thị tất cả bài đăng

Thứ Bảy, 23 tháng 8, 2014

Fix error " /dev/sda1 was not cleanly unmounted, check forced " on Ubuntu Server

/dev/sda1 was not cleanly unmounted, check forced
10.2% non-contiguous
mountall: fsck /boot [286] terminated with status 1
---
Boot Ubuntu on recovery mode
---
#umount /dev/sda1
#if errors: -y auto answers yes for fixes needing response see man e2fsck
sudo e2fsck -f -y -v /dev/sda1

Thứ Bảy, 27 tháng 7, 2013

Increase disk space Ubuntu VM + remove old kernel in /boot

1. Remove all snapshots
2. Increase provisioned size of ubuntu VM
3. Restart VM 
4. Folow instructions below. Remember to increase EXT partition first then increase LVM volume later
http://www.joomlaworks.net/blog/item/168-resizing-the-disk-space-on-ubuntu-server-vms

Remove old kernel in /boot
Your boot partition is full. Since this is a kernel update, these files will be copied to the boot partition so you need to clean in out. Here is a blog post that will show you how to clear the old kernel images with one command. I'll give a basic synopsis of the method. Use this command to print out the current version of your kernel:
 
uname -r
Then use this command to print out all the kernels you have installed that aren't your newest kernel
 
dpkg -l linux-* | awk '/^ii/{ print $2}' | grep -v -e `uname -r | cut -f1,2 -d"-"` | grep -e [0-9]
Make sure your current kernel isn't on that list. Notice how this is the majority of the final command (down below). To uninstall and delete these old kernels you will want to pipe these arguments to:
 
sudo apt-get -y purge
Now we can do everything we want by combining these last two commands into this unholy mess:
 
dpkg -l linux-* | awk '/^ii/{ print $2}' | grep -v -e `uname -r | cut -f1,2 -d"-"` | grep -e [0-9] | xargs sudo apt-get -y purge

And that one command will take care of everything for you. I will confirm that this does work perfectly but never trust anybody on the internet. :) For more info, the blog post gives a very good explanation of what each part of the command does so read through it so you are satisfied that it does what you want it to do.

http://askubuntu.com/questions/89710/how-do-i-free-up-more-space-in-boot

Thứ Tư, 8 tháng 5, 2013

Error HTTP 500 access to RoundCube webmail after upgrade ISPConfig to 3.0.5.1

Get error "http 500 internal server error" when trying to access Roundcube webmail after upgrade ISPConfig to 3.0.5.1 (error still remains after upgrade again to 3.0.5.2)
- First check Roundcube error log at /var/log/roundcube
Found errors:
PHP Error: Failed to load plugin file /var/lib/roundcube/plugins/fail2ban/fail2ban.php in /usr/share/roundcube/program/include/rcube_plugin_api.php on line 196 (GET /webmail/)
- Check roundcube config in /var/lib/roundcube/config/main.inc.php for syntax
$rcmail_config['plugins'] = array('fail2ban');
Syntax is correct.
- Check /usr/share/roundcube/plugins/fail2ban/fail2ban.php. Found fail2ban ver 1.0 in directory plugins
- Try to upgrade fail2ban to ver 1.1 following directions below:
--------------------
Install the roundcube logger plugin form http://mattrude.com/projects/roundcube-fail2ban-plugin/.
Basically you have to download the above file (fail2ban.php) and paste it in the fail2ban folder in the plugins folder of roundcube: /usr/share/roundcube/plugins/fail2ban/fail2ban.php
This plugin will first create and then update the log file with each login attempt: /var/log/roundcube/userlogins

cd /usr/share/roundcube/plugins/fail2ban/
wget https://github.com/mattrude/rc-plugin-fail2ban
mv rc-plugin-fail2ban fail2ban.tgz
tar xvfz fail2ban.tgz

Extend the jail.local file that Falko suggests in The Perfect Server - Debian Squeeze (Debian 6.0) With BIND & Courier [ISPConfig 3]: /etc/fail2ban/jail.local

Last (and very important) don't forget to create the roundcube.conf file /etc/fail2ban/filter.d/roundcube.conf with the contents below:
----
[Definition]
failregex = FAILED login for .*. from
ignoreregex =
----
Sources: http://www.howtoforge.com/easy-roundcube-over-ssl-and-webmin-with-fail2ban-for-ispconfig-3-on-debian-squeeze
http://mattrude.com/projects/roundcube-fail2ban-plugin/

Restart fail2ban and apache but problem is not solved. Try to look at apache error log (not roundcube error log)
Found error
--------- 
SoftException in Application.cpp:221: File "/usr/share/roundcube/index.php" is not in document root of Vhost "/var/www/ispconfig/"
Premature end of script headers: index.php
---------
Anh here is solution for it
http://www.howtoforge.com/forums/showthread.php?t=60746
http://www.howtoforge.com/perfect-server-ubuntu-12.10-apache2-bind-dovecot-ispconfig-3-p4

Thank you HowToForge

Thứ Ba, 12 tháng 3, 2013

Fix errors listed in ISPConfig 3 log file

Uninstall Xcache and solving error Failed loading cannot open shared object file: No such file or directory
When you got this
   
"Failed loading /usr/lib/php5/20090626/xcache.so:  /usr/lib/php5/20090626/xcache.so: cannot open shared object file: No such file or directory"

This because you not removing xcache configuration from php.In this example, i using php5-fpm. If you’re using apache2 + php5, so you can find it on /etc/php5/apache2/

How to solve this problem:
   
1. Removing extension="xcache.so" from /etc/php5/fpm/php.ini
   
2. Delete file xcache.ini from folder /etc/php5/fpm/conf.d/

-------------

PHP Warning: PHP Startup: apc.shm_size now uses M/G suffixes, please update your ini files in Unknown on line 0

Edit apc.ini
sudo nano /etc/php5/fpm/conf.d/apc.ini

Change
apc.shm_size="256"
to
apc.shm_size="256M"

Restart MySQL, httpd  service

service mysql stop && sleep 1 && service mysql start && sleep 1 && service httpd graceful
or
service mysql stop && sleep 1 && service mysql start
/etc/init.d/apache2 restart 
 

Thứ Năm, 17 tháng 1, 2013

Upgrade Ubuntu 11 to 12

Upgrade Ubuntu From 11.04 to 11.10
Upgrade Ubuntu From 11.10 to 12.04
To upgrade from Ubuntu 11.10 on a server system, follow the steps listed below:
Install the update-manager-core package (if it is not already installed).
Run sudo do-release-upgrade to launch the upgrade tool. Follow the on-screen instructions. Note that the server upgrade is now more robust and will utilize GNU screen and automatically re-attach in case of dropped connection problems, for example.
So, type the following commands:
sudo apt-get install update-manager-core

sudo do-release-upgrade

sudo apt-get update && sudo apt-get upgrade
 
Check version after upgrade
cat /etc/issue
or
cat /etc/issue.net
 
Upgrade from Ubuntu 12.04 LTS to 12.10

First of all we have to check if the new version is available. Open a terminal Ctrl+Alt+T and give this command.
do-release-upgrade -c
This command will check if the new version is available from the servers and will return the result.
If the version is available we can proceed.
If the version is not available then check one thing. Open this file
gksudo gedit /etc/update-manager/release-upgrades and see if Prompt is equal to normal Prompt=normal , If its not , then change it and after you save the file run in terminal
sudo apt-get update do-release-upgrade -c

Thứ Bảy, 15 tháng 9, 2012

secure path to phpmyadmin with SSL

Có vài cách để thực hiện việc này:

1. Using phpMyAdmin’s config.inc.php file:
// place this at the bottom somewhere
$cfg['ForceSSL'] = true;

Cách này chưa thử. Có lẽ không được vì sẽ sử dụng port 443 -> xung đột với ứng dụng khác

2. Sử dụng digest authentication thay cho basic authentication
http://ileriseviye.org/blog/sysadmin/security-tip-of-the-day-use-htdigest-instead-of-htpasswd-for-phpmyadmin-and-other-sensitive-stuff/

http://www.googlux.com/basic-digest-auth.html

Nhược điểm là thêm một lần nhập username và password -> bất tiện

3. Redirect
http://www.howtoforge.com/extending-perfect-server-debian-squeeze-ispconfig-3-p3
Edit & append to the end of file phpmyadmin.conf

nano /etc/apache2/conf.d/phpmyadmin.conf

-----------
< IfModule mod_rewrite.c>
  < IfModule mod_ssl.c>
    < Location /mydomaindb>
      RewriteEngine on
      RewriteCond %{HTTPS} !^on$ [NC]
      RewriteRule . https://%{HTTP_HOST}:50443%{REQUEST_URI}  [L]
    < /Location>
  < /IfModule>
< /IfModule>
-----------
Restart Apache
/etc/init.d/apache2 restart

Thứ Năm, 13 tháng 9, 2012

Install curl in ubuntu 12.04

apt-get install curl libcurl3 libcurl3-dev php5-curl
restart apache

Check phpinfo() to see a new section with Curl info

Thứ Sáu, 18 tháng 5, 2012

reset password for root user - ubuntu server 11.04

1. Reboot the machine.
2. Press the ESC key while GRUB is loading to enter the menu.
3. Select ‘recovery mode’ option.
4. Select ‘drop to root shell prompt’.
5. ‘# nano /etc/passwd’ gives you a list of users
6. change any users password with ‘# passwd [username]
(nếu là root chỉ cần gõ passwd)
Nếu gặp lỗi authentication token manipulation error thì thực hiện lệnh dưới trước khi reset password
mount -rw -o remount /

--------------------------------------
Also make sure you are mounting the file system read/write.
After immediately selecting 'Drop into root shell prompt' I found the filesystem was mounted read only, which prevents resetting the password.
Choosing the option to remount / as read/write and going back into the root shell prompt enabled the password change.
The command to run prior to changing the password is: mount -rw -o remount /

nguồn:
http://burnz.wordpress.com/2008/09/09/how-to-reset-ubuntu-root-password/

http://askubuntu.com/questions/91188/authentication-token-manipulation-error
--------------------------------

Thứ Sáu, 16 tháng 3, 2012

Summary of Ubuntu Linux

FTP Server Installation

sudo apt-get install vsftpd

Anonymous FTP Configuration

By default vsftpd is not configured to only allow anonymous download. If you wish to enable anonymous download edit /etc/vsftpd.conf changing:
anonymous_enable=Yes During installation a ftp user is created with a home directory of /srv/ftp. This is the default FTP directory.
If you wish to change this location, to /srv/files/ftp for example, simply create a directory in another location and change the ftp user's home directory:
sudo mkdir /srv/files/ftp sudo usermod -d /srv/files/ftp ftp

User Authenticated FTP Configuration

By default vsftpd is configured to authenticate system users and allow them to download files. If you want users to be able to upload files, edit /etc/vsftpd.conf:
write_enable=YES 
 
Now restart vsftpd:sudo restart vsftpd

Nguồn: https://help.ubuntu.com/10.10/serverguide/C/ftp-server.html
-------------------------------
Install desktop Environment
First you nee to make sure you have enabled Universe and multiverse repositories in /etc/apt/sources.list file once you have enable you need to use the following command to install GUI
sudo apt-get update
sudo apt-get install ubuntu-desktop
The above command will install GNOME desktop
If you wan to install a graphical desktop manager without some of the desktop addons like Evolution and OpenOffice, but continue to use the server flavor kernel use the following command
sudo aptitude install --without-recommends ubuntu-desktop
If you want to install light weight desktop install xfce using the following command
sudo apt-get install xubuntu-desktop
If you want to install KDE desktop use the following command
sudo apt-get install kubuntu-desktop
Chu y: sau khi test chi co ubuntu-desktop (ban full) va kubuntu la chay dc

Link: http://www.ubuntugeek.com/install-gui-in-ubuntu-server.html
--------------------------

Configuring Static ip address in Ubuntu server

If you want to install vim editor use the following command

    sudo apt-get install vim-full

Ubuntu installer has configured our system to get its network settings via DHCP, Now we will change that to a static IP address for this you need to edit

Edit /etc/network/interfaces and enter your ip address details (in this example setup I will use the IP address 172.19.0.10):

    sudo vi /etc/network/interfaces
 
nếu dùng kubuntu
    sudo kate /etc/network/interfaces

and enter the following save the file and exit (In vi, ESC, then ZZ to save and exit)

# The primary network interface

auto eth0
iface eth0 inet static
address 172.19.0.10
netmask 255.255.255.0
#network 172.19.0.0
#broadcast 172.19.0.255
gateway 172.19.0.1

Now you need to restart your network services using the following command

    sudo /etc/init.d/networking restart

You need to setup manually DNS servers in resolv.conf file when you are not using DHCP.

    sudo vi /etc/resolv.conf

You need to add look something like this

search domain.com
nameserver xxx.xxx.xxx.xxx
 
Lệnh kiểm tra 
ifconfig
 
Thay đổi host, workgroup
 
sudo gedit /etc/hostname
Sửa hosts file
sudo gedit /etc/hosts
 
Change your system workgroup name, run the command below to edit samba smb.conf file. 
sudo gedit /etc/samba/smb.conf
 
Lưu ý: thay gedit bằng hoặc vi, kate... nếu không dùng ubuntu desktop
 

------------------

Install VMware Tools for Ubuntu
Link: http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1022525

Ubuntu Server with only a Command Line Interface

    Go to Virtual Machine > Install VMware Tools (or VM > Install VMware Tools).

    Note: If you are running the light vesion of Fusion, or a version of Workstation without VMware Tools, or VMware Player, you are prompted to download the Tools before they can be installed. Click Download Now to begin the download.


    In the Ubuntu guest, run these commands:

        sudo mkdir /mnt/cdrom

        When prompted for a password, enter your Ubuntu admin user password.

        Note: For security reasons, the typed password is not displayed. You do not need to enter your password again for the next five minutes.

        sudo mount /dev/cdrom /mnt/cdrom

        The file name of the VMware Tools bundle varies depending on your version of the VMware product. Run this command to find the exact name:

        ls /mnt/cdrom

        tar xzvf /mnt/cdrom/VMwareTools-.tar.gz -C /tmp/

        Note:  is the version discovered in the previous step.

        cd /tmp/vmware-tools-distrib/

        sudo ./vmware-install.pl -d

        Note: The -d switch assumes that you want to accept the defaults. If you do not use -d, press Return to accept each default or supply your own answers.

    Run this command to reboot the virtual machine after the installation completes:

    sudo reboot 
------------
Reset MySQL root password 
In this tip we will see how to change or reset the MySQL root password 
under Ubuntu. This tip is tested under Ubuntu 11.10 and may work for 
other older versions of Ubuntu (11.04/10.10/10.04 or older).

This tutorial is also useful for users that forget to assign a MySQL 
root password during the installation of the MySQL client. If no 
password assigned, you may get this error when trying to login to the 
MySQL server:

ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

Getting Started
1. Open the terminal (Ctrl+Alt+T) and stop the MySQL server with this command:
sudo /etc/init.d/mysql stop
2. Run now this command to start the MySQL configuration:
sudo mysqld --skip-grant-tables &
3. Login now to the MySQL server as root:
mysql -u root mysql
4. Change now your MySQL root password with this command:
UPDATE user SET Password=PASSWORD('NEWPASSWORD') WHERE User='root'; FLUSH PRIVILEGES; exit;
Replace NEWPASSWORD with any password of your choice.
You can now login smoothly to the MySQL server with the assigned password. 
 
Link: https://help.ubuntu.com/community/MysqlPasswordReset 
 
------------------------------- 
Nếu đang dùng ubuntu desktop -> Ctrl – Alt – T to open Terminal.
Hướng dẫn sử  dụn vi tại đây http://www.cs.colostate.edu/helpdocs/vi.html 

 

Thứ Bảy, 18 tháng 6, 2011

Làm quen với Ubuntu trong 8h

1. Install Ubuntu desktop i386 (client)
2. Gán static IP  không được (chưa hiểu vì sao), để DHCP thì OK
3. Add account vào nhóm administrator (để có thể cài đặt được các packages). Lưu ý phải gán acc thuộc một nhóm (ví dụ www-data) để có thể chmode cho thư mục /var/www sau này
4. Install VMWare Tool cho Ubuntu theo hướng dẫn tại:
http://www.ubuntugeek.com/howto-install-vmware-tools-in-ubuntu.html
5. Thực hiện cài LAMP cho Ubuntu theo hướng dẫn tại:
http://mazesolutions.me/linuxunix/installing-lamp-on-ubuntu-710-linuxapachemysqlphp
Mặc dù trên apachefriends.org có script for linux (http://www.apachefriends.org/en/xampp-linux.html) nhưng sử dụng apt-get theo hướng dẫn ở trên có ưu điểm là sẽ update tự động được
6. Cài đặt FTP server theo hướng dẫn tại
http://www.jonathanmoeller.com/screed/?p=2981
7.  thay đổi quyền đối với /var/www theo hướng dẫn dưới đây

-------------------
Re: can't write to /var/www - logged in as admin too
It's likely to be just a file permission setting on the directory - if you login with SFTP then the account that you specify on the remote system should have *execute* permissions for the directory in order to work with it.

This sets "www-data" as the owning group for /var/www and everything that it contains:

sudo chgrp -R www-data /var/www

And this grants the owning group read, write and execute on all files:

sudo chmod -R 775 /var/www

The fact that the directory happens to be used by Apache isn't really important in this case, as you aren't accessing it through the Apache service.
--------------------
8. Cấu hình Virtual Host để host nhiều website theo hướng dẫn tại
http://httpd.apache.org/docs/2.0/vhosts/examples.html

9. Cấu hình remote desktop để remote controll Ubuntu thông qua Real VNC

10. Sử dụng vi để edit các file cấu hình conf (hướng dẫn sử dụng nhanh vi tại đây http://blogs.tech-recipes.com/johnny/vim-quick-reference/). Đặc biệt ghét dùng vi vì thao tác rất rắc rối. Tại sao cứ phải ấn Esc rồi mới thực hiện lệnh??


Cuối cùng chính vì vi rắc rối quá nên đành tạm dừng việc tìm hiểu lại để làm theo cách quen thuộc là Windows XP + XAMPP. Mình có tật rất xấu là cứ thích làm cái mới trong khi deadline đang đến gần. Hình như bị giục thì mới có hứng! Bỏ mẹ

Lúc nào rảnh nghiên cứu tiếp Ubuntu (gồm cả server và client). Bây giờ phải hoàn thành công việc đã (còn 6h nữa là hết hạn). Nghiên cứu mấy món trên mất khoảng 8h (không biết thế có quá chậm ko nhỉ)