Chủ Nhật, 26 tháng 10, 2014

Reinstall / Recover GRUB from Ubuntu live CD / USB

This is the common problem which is faced, when you try for dual boot. Easily Recover / Re-Install Grub in Ubuntu using Boot-Repair from live cd / usb. Boot Repair is the simple graphical tool used to repair, restore or reinstall the grub bootloader on Ubuntu. Now this tools has been updated with some new features in advanced option, using boot- repair you can also restore the MBR on Windows.
On dual boot once you update your Ubuntu OS, Windows / Fedora will not be listed on your grub. After installing Windows / Fedora your Ubuntu will not boot anymore and its grub may be wiped out. To restore it follow the steps below

To Reinstall Grub

You need to have Ubuntu Live CD or Live USB. Normal session can be used to repair the grub. Boot using your Ubuntu Live CD or Live USB, while booting choose Try Ubuntu.
Once booted then open a terminal, and run the following command one by one to install the boot repair.
To add boot-repair to the repository
sudo add-apt-repository ppa:yannubuntu/boot-repair
To Update your repository
sudo apt-get update
To install boot-repair
sudo apt-get install -y boot-repair
Once Installation complete run boot-repair on terminal by typing the following command or select it by System->Aministration->Boot Repair.
boot-repair
NOTE: Update the Boot Repair if its newer version is available.
It will scan the System for few seconds and will show you the options Recommended repair and Create a BootInfo summary. By clicking the Recommended Repair it will start repair the grub. Check the screen shots below.
Once done click ok and restart your system, your grub should work now. If not run the boot-repair again using live cd / usb. Then follow the steps below.
Select the Advanced options, In Main options tab check whether the following options are selected or not. If not select it, the options are Reinstall Grub and unhide boot menu for 10 seconds. Check the screen shot below
Then select the GRUB locations tab and check the following options are selected or not. The options are OS to boot by default and place grub into, In “OS to boot by default” option choose the OS which you want to be default on boot. Then select the drive where you need to reinstall the grub in “place grub into” option and click apply. Check the screen shots below
Click ok and restart your System. To restore MBR Click Here.
Hope this will be helpful for you!!!


Source:  http://www.howopensource.com/2012/05/reinstall-recover-grub-from-ubuntu-12-04-live-cd-usb/

Fix FN Key not working in Ubuntu for Laptop Toshiba

1) Edit /etc/default/grub and change this variable:
GRUB_CMDLINE_LINUX="pcie_aspm=force acpi_osi=Linux acpi_backlight=legacy"
2) Edit /etc/modprobe.d/blacklist.conf and add this line at the end of the file:
blacklist toshiba_acpi
3) Update the grub config file:
sudo update-grub
4.) Reboot.

Thứ Tư, 13 tháng 8, 2014

ClassicMenu Indicator

Category: Application starter
Provides a simple way to get a classic GNOME-style application menu for those who prefer this over the Unity dash menu. Like the classic GNOME menu, it includes Wine games and applications if you have those installed.
enter image description here
Get the most recent version from its web page (PPA available for Ubuntu 11.04, 11.10 and 12.04).


Source:  http://askubuntu.com/

Weather Indicator

Category: Weather Forecasting
Warning. This indicator is not being updated anymore and will probably not work in current versions of Ubuntu.
UPDATE ! Development continues! https://launchpad.net/weather-indicator/+announcement/11516
Displays the current/extended weather, multiple locations and notifications support.
Weather Indicator
indicator-weatherInstall indicator-weather in Ubuntu Software Centre
or project's PPA: ppa:weather-indicator-team/ppa
Please note! The latest builds of Weather Indicator require updated versions of pywapi, Python Weather API: ppa:pywapi-devel/ppa


Source:  http://askubuntu.com/

System Load Indicator

Category: System Information
Network, memory and cpu usage indicator; this is a port of the original System Monitor GNOME Panel applet (gnome-system-monitor applet).
enter image description here
In Preferences you can customize the output to fit it to your desktop theme:
preferences dialog

To install:

You can install it through the Ubuntu Software Centre by clicking this button:
Install via the software center
or through the command line:
sudo apt-get install indicator-multiload
If you want the latest updates, you can install it from the PPA with these commands:
sudo add-apt-repository ppa:indicator-multiload/stable-daily
sudo apt-get update
sudo apt-get install indicator-multiload


Source:  http://askubuntu.com/

StackApplet

Category: Other
StackApplet is a GNOME panel applet that monitors your activity on any StackExchange site.
stackapplet
stackapplet Install stackapplet in Ubuntu Software Center

Update:

As indicated in comments, the version of StackApplet in the Ubuntu Software Center is old and broken. To install it, use instead this ppa.
The first time the application is used, run
python /usr/share/stackapplet/stackapplet.py &
from a terminal.

For Ubuntu 14.04:

1.5.1 is available on universe repositories
So after enabling universe repositories, It can be installed by following command:
sudo apt-get update
sudo apt-get install stackapplet
But it has bug with adding account so upgrade to 1.5.2 as follows:
sudo add-apt-repository ppa:stackapplet-dev/stackapplet
sudo apt-get update
sudo apt-get install stackapplet


Source: http://askubuntu.com/ 

Hardware Sensors Indicator

Category: System Information

Application Indicator showing hardware sensors.
sensors
First add the repository:
sudo apt-add-repository ppa:alexmurray/indicator-sensors 
Update:
sudo apt-get update  
And then install the package:
sudo apt-get install indicator-sensors
Then launch Hardware Sensors Indicator from Unity or run indicator-sensors from a terminal.




Source:  http://askubuntu.com/

Thứ Hai, 4 tháng 8, 2014

OpenSSH Server


Introduction

This section of the Ubuntu Server Guide introduces a powerful collection of tools for the remote control of networked computers and transfer of data between networked computers, called OpenSSH. You will also learn about some of the configuration settings possible with the OpenSSH server application and how to change them on your Ubuntu system.
OpenSSH is a freely available version of the Secure Shell (SSH) protocol family of tools for remotely controlling a computer or transferring files between computers. Traditional tools used to accomplish these functions, such as telnet or rcp, are insecure and transmit the user's password in cleartext when used. OpenSSH provides a server daemon and client tools to facilitate secure, encrypted remote control and file transfer operations, effectively replacing the legacy tools.
The OpenSSH server component, sshd, listens continuously for client connections from any of the client tools. When a connection request occurs, sshd sets up the correct connection depending on the type of client tool connecting. For example, if the remote computer is connecting with the ssh client application, the OpenSSH server sets up a remote control session after authentication. If a remote user connects to an OpenSSH server with scp, the OpenSSH server daemon initiates a secure copy of files between the server and client after authentication. OpenSSH can use many authentication methods, including plain password, public key, and Kerberos tickets.

Installation

Installation of the OpenSSH client and server applications is simple. To install the OpenSSH client applications on your Ubuntu system, use this command at a terminal prompt:
sudo apt-get install openssh-client
To install the OpenSSH server application, and related support files, use this command at a terminal prompt:
sudo apt-get install openssh-server
The openssh-server package can also be selected to install during the Server Edition installation process.

Configuration

You may configure the default behavior of the OpenSSH server application, sshd, by editing the file /etc/ssh/sshd_config. For information about the configuration directives used in this file, you may view the appropriate manual page with the following command, issued at a terminal prompt:
man sshd_config
There are many directives in the sshd configuration file controlling such things as communication settings and authentication modes. The following are examples of configuration directives that can be changed by editing the /etc/ssh/sshd_config file.
[Tip]
Prior to editing the configuration file, you should make a copy of the original file and protect it from writing so you will have the original settings as a reference and to reuse as necessary.
Copy the /etc/ssh/sshd_config file and protect it from writing with the following commands, issued at a terminal prompt:
sudo cp /etc/ssh/sshd_config /etc/ssh/sshd_config.original
sudo chmod a-w /etc/ssh/sshd_config.original
The following are examples of configuration directives you may change:
  • To set your OpenSSH to listen on TCP port 2222 instead of the default TCP port 22, change the Port directive as such:
    Port 2222
  • To have sshd allow public key-based login credentials, simply add or modify the line:
    PubkeyAuthentication yes
    In the /etc/ssh/sshd_config file, or if already present, ensure the line is not commented out.
  • To make your OpenSSH server display the contents of the /etc/issue.net file as a pre-login banner, simply add or modify the line:
    Banner /etc/issue.net
    In the /etc/ssh/sshd_config file.
After making changes to the /etc/ssh/sshd_config file, save the file, and restart the sshd server application to effect the changes using the following command at a terminal prompt:
sudo /etc/init.d/ssh restart
[Warning]
Many other configuration directives for sshd are available for changing the server application's behavior to fit your needs. Be advised, however, if your only method of access to a server is ssh, and you make a mistake in configuring sshd via the /etc/ssh/sshd_config file, you may find you are locked out of the server upon restarting it, or that the sshd server refuses to start due to an incorrect configuration directive, so be extra careful when editing this file on a remote server.

SSH Keys

SSH keys allow authentication between two hosts without the need of a password. SSH key authentication uses two keys aprivate key and a public key.
To generate the keys, from a terminal prompt enter:
ssh-keygen -t dsa
This will generate the keys using a DSA authentication identity of the user. During the process you will be prompted for a password. Simply hit Enter when prompted to create the key.
By default the public key is saved in the file ~/.ssh/id_dsa.pub, while ~/.ssh/id_dsa is the private key. Now copy theid_dsa.pub file to the remote host and append it to ~/.ssh/authorized_keys by entering:
ssh-copy-id username@remotehost
Finally, double check the permissions on the authorized_keys file, only the authenticated user should have read and write permissions. If the permissions are not correct change them by:
chmod 600 .ssh/authorized_keys
You should now be able to SSH to the host without being prompted for a password.

References



Source: https://help.ubuntu.com/10.04/serverguide/openssh-server.html

Thứ Bảy, 29 tháng 3, 2014

Sử dụng Mod Rewrite trong Apache 2.4.6 trên Ubuntu 13.10

Chúng ta thiết lập trên 2 file:
/etc/apache2/apache2.conf
/etc/apache2/sites-available/000-default.conf
/etc/apache2/sites-enabled/000-default.conf chuyển sang /etc/apache2/sites-available/000-default.conf
Sửa apache2.conf và thêm
<Directory /home/my_site/public_html/>
    #YOUR SETTINGS
</Directory>
Sửa sites-available/000-default.conf và thay thế <VirtualHost *:80> thành <VirtualHost localhost:80>
Thêm vào file sites-available/000-default.conf nội dung sau
<VirtualHost mysite.localhost:80> 
    ServerName mysite.localhost

    ServerAdmin webmaster@mysite.localhost

    DocumentRoot /home/my_new_site_public_html

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
Sửa /etc/hosts/ 
 IP của mysite.localhost từ127.0.1.1 thành 127.0.0.1
Truy cập http://mysite.localhost & http://localhost/


Source: http://stackoverflow.com/ 

Install the MongoDB PHP Driver on Ubuntu



First, to get this thing going, we'll need to resolve some dependencies. To do that, run this command from the terminal:
$ sudo apt-get install php-pear php5-dev
Next, you should easily be able to install the driver with the following command:
$ sudo pecl install mongo
What makes Ubuntu 12.04 a little different from other systems in how PHP extensions get loading when Apache/PHP starts. To make sure this extension gets loaded, we'll need to add a .ini file to "/etc/php5/conf.d". To do that, run the following command:
$ sudo touch /etc/php5/conf.d/mongo.ini
After creating the file, add this line of content:
extension=mongo.so
After you've saved your new .ini file, restart Apache and verify that the extension is loading withphpinfo().


Source:  http://zacvineyard.com/

Thứ Sáu, 28 tháng 3, 2014

How to Repair, Restore, or Reinstall Grub 2 with a Ubuntu Live CD or USB

Grub 2 typically gets overridden when you install Windows or another Operating System. To make Ubuntu control the boot process, you need Reinstall (Repair/Restore) Grub using a Ubuntu Live CD.

Warning:

Using the sudo command, especially from a Live CD can do serious damage to your system. Read all instructions and confirm you understand before executing any commands. When pasting into the Terminal, useCtrl+Shift+V, NOT Ctrl+V.

Terminal Commands:

Mount the partition your Ubuntu Installation is on. If you are not sure which it is, launch GParted (included in the Live CD) and find out. It is usually a EXT4 Partition. Replace the XY with the drive letter, and partition number, for example: sudo mount /dev/sda5 /mnt.
sudo mount /dev/sdXY /mnt
Now bind the directories that grub needs access to to detect other operating systems, like so:

Now we jump into that using chroot.

Now install, check, and update grub.
This time you only need to add the drive letter (usually a) to replace X, for example: grub-install /dev/sdagrub-install –recheck /dev/sda.
grub-install /dev/sdXgrub-install --recheck /dev/sdX
Now grub is back, all that is left is to exit the chrooted system and unmount everything.

Shut down and turn your computer back on, and you will be met with the default Grub2 screen.
You may want to update grub or re-install burg however you like it.

Congratulations, you have just Repaired/Restored/Reinstalled Grub 2 with a Ubuntu Live CD!



Source: http://howtoubuntu.org/ 

Best of Sublime Text 3: Features, Plugins, and Settings

Sublime Text 3  is an amazing piece of software. To start, it is a clean, functional, and fast code editor. Not only does it have incredible built in features (multi-edit and vim mode), but it has support for plugins, snippets, and many other things.
I know there have already been many articles like this online, but I am teaching a class on Sublime Text and thought it would be good to have all the information online. In this article, we’ll be diving into the best parts of Sublime Text. You’ve probably already heard of some of these, but maybe not some others.

 Features

Command Palette ctrl + shift + p

The command palette let’s you access pretty much anything in the settings menus, call your package commands, change file syntax, handle Sublime projects, and so much more.
For instance, you are able to call Git commands add, branch, commit, push, and pull all from the command palette.
To Usectrl + shift + p
set-syntax-html
git-commands

File Switching ctrl + p

Sublime Text provides a really fast way to open up new files. Just press ctrl + p and start typing the name of the file you want. Once it shows up, just press enter and start typing directly into that file!
To Usectrl + p
sublime-file-opener

Goto Symbols ctrl + r

When you have a large file with a bunch of methods, pressing ctrl + r will list them all and make them easier to find. Just start typing the one you want and press enter.
To Usectrl + r
goto-symbol
Sublime Text 3 also has a new feature (Goto Definition). It provides Sublime Text with more capabilities closer to an IDE. Take a look at that if you’re interested.

Multi-Edit ctrl + click

This is in my opinion, the absolute best feature of Sublime. After using it here, it’s hard to go back to other text editors. There are many different ways to use multi-edit:
  • ctrl + d: Select the current word and the next same word
  • ctrl + click: Every place you click will create a cursor to edit
  • ctrl + shift + f AND alt + enter: Find a word in your files and then select them all
multiedit

Snippets

Snippets are yet another great feature of Sublime Text. You can use the pre-installed ones, build your own, or install a package that has more. All you have to do is type in a word and it will expand into your snippet. For example, typing lorem will generate lorem ipsum text.
To Use: Type a word that activates a snippet (ie lorem) and press tab.
sublime-snippet-lorem
sublime-snippet-lorem-tab
Here’s a great article on creating snippets .

Keyboard Shortcuts

The amount of keyboard shortcuts in Sublime are astounding. This is my other absolute best feature of Sublime. The less I can move away from the home keys on my keyboard, the more efficient I can be.
For a full list of the Sublime Text Keyboard Shortcuts, take a look at our keyboard shortcuts article.

Projects

Projects is an integral part of my workflow in Sublime Text. A project is just a Sublime workspace in which your folders are open and stored in the sidebar. This helps since you can define a project and add folders to it, and be able to switch between folders quickly.
Using projects, you will no longer have to go digging in Windows Explorer or Finder to get the project you want and drag it into Sublime.
To Save a Project: Go into the command palette and type save project
To Switch Projectsctrl + alt + p
sublime-project-switch

 Packages/Plugins

Package Control

The absolutely necessary package manager for Sublime. This is the optimal way to install all of the plugins and themes listed below.
Go ahead and install that at the package control  site.
To Use: Go into the command palette (ctrl + shift + p) and type install.
Package Control will load all the packages available for install. Take a look at all the great things you can install and find your favorite packages..

Alignment

A very simple and easy to use plugin. I’m a very big fan of making your code organized and good looking. It helps tons when you revisit the code later down the road. Alignment helps with that.
To Use: Highlight the lines you want to align and press ctrl + alt + a
alignment-before
alignment-after

BracketHighlighter

This plugin provides bracket highlighting for all sorts of brackets.
brackethighlighter

Colorpicker

Have the ability to change colors with a colorpicker on the fly.
To Usectrl + shift + c
sublime-colorpicker
Note: This plugin is much prettier when using it on Mac

Emmet

Emmet is an absolute time saver. You can build HTML on the fly easily and quickly.
To Usectrl + alt + enter and start typing your Emmet styled HTML
sublime-emmet-start
sublime-emmet-finish
Check out our Emmet Interactive Guide to learn more and try out Emmet for yourself.

DocBlockr

A really great way to easily create doc blocks for many languages including JavaScript, PHP, and CoffeeScript. Just type in /** above your function and press tab. Watch the magic as DocBlockr takes the function name and variables and creates your doc block.
sublime-docblockr-example-start
sublime-docblockr-example-finish

Git

Git helps you interact with your Git repo. It has support for all sorts of things like init, push, pull, branch, stash, and more.

GitGutter

This is a small, but useful plugin that will tell you what lines have changed since your last Git commit. An indicator will show in the gutter next to the line numbers.
sublime-git-gutter

Gist

This plugin allows you to pull your Gists and insert them into your file. This is helpful when you have a Gist to start an HTML file or any other reusable code you have.
To Use: Open up the command palette and type gist. You can also use the shortcuts that are shown.
sublime-gist

SidebarEnhancements

This plugin provides a great deal more choices when right clicking on a file in the sidebar. The ability to open, find, copy and paste, and more are all provided.
Here is the old menu vs the SidebarEnhanced menu.
sublime-sidebar-enhancements-before
sublime-sidebar-enhancements-after

Themes

There are some really cool looking themes you can install for Sublime. You can find these by using Package Control.
Install a theme with Package Control and then update your User Settings to use it.
// User/Preferences.sublime-settings
{
 "theme": "Soda Light.sublime-theme"
}

Note: You might have to restart Sublime for these changes to take effect.
Some popular themes:

Theme – Soda comes with light and dark

soda-2-light-theme
soda-2-dark-theme

Theme – Flatland

sublime-flatland

Predawn

sublime-predawn
An offshoot of Flatland. Check out the repo  and the great work by Jamie Wilson .

Spacegray

“A Hyperminimal UI Theme”. More information found here . Thanks to the link by Jentan Bernardus .
spacegray-sublime-text-theme

More Themes

Here is a great writeup on Beautiful Themes for Sublime Text 3  by Abu Ashraf Masnun . Take a look at more great themes there.

 Color Schemes

In addition to changing your theme, you can also change your color scheme. These differ from themes since themes are packages for Sublime. Color Schemes are just a color scheme file and changing your settings.
To Change Color Scheme: Go into your menus, Preferences > Color Scheme and select one.
You will see changes immediately and can check if you like it or not. For a list of some great color schemes, check out Dayle Rees’s colour schemes  repo or color sublime , a great project.

 Settings

Sublime comes with an insane amount of settings. I would encourage you go look at everything it has to offer.
To get to your user settings, use the command palette and type in user.
Here are my current settings, most are self explanatory. Pick and choose the good parts for yourself and make your own custom settings!
// User/Preferences.sublime-settings
{
 "bold_folder_labels": true,
 "color_scheme": "Packages/Theme - Flatland/Flatland Monokai.tmTheme",
 "font_face": "Ubuntu Mono",
 "font_options": "subpixel_antialias",
 "font_size": 14,
 "highlight_line": true,
 "highlight_modified_tabs": true,
 "ignored_packages":
 [
 ],
 "line_padding_bottom": 1,
 "line_padding_top": 1,
 "rulers":
 [
  80
 ],
 "scroll_past_end": true,
 "tab_size": 4,
 "tab_completion": false,
 "theme": "Soda Light.sublime-theme",
 "translate_tabs_to_spaces": true,
 "trim_trailing_white_space_on_save": true,
 "vintage_start_in_command_mode": true,
 "word_wrap": true
}

I use the great Vintage mode  in Sublime. It provides vi editing commands inside of Sublime Text. It isn’t as fully featured as the original vi package, but it is the closest that I’ve seen in any text editor currently. That along with your keyboard shortcuts and command packages will make for a very fast developer.
The settings above automatically turn on Vintage mode when you open a file. If you don’t like this feature, just remove vintage_start_in_command_mode and if you want to disable Vintage altogether, remove the ignored_packages setting.

 Conclusion

There are so many parts to Sublime that I’m sure I missed some great things. Let me know if you find any other awesome packages or features and happy coding!


Source:  http://scotch.io/