mirror of
https://github.com/LCTT/TranslateProject.git
synced 2024-12-26 21:30:55 +08:00
20131224-3 选题
This commit is contained in:
parent
eb4ae1daea
commit
ccea454311
125
sources/How to upgrade MySQL server on Debian or Ubuntu.md
Normal file
125
sources/How to upgrade MySQL server on Debian or Ubuntu.md
Normal file
@ -0,0 +1,125 @@
|
||||
How to upgrade MySQL server on Debian or Ubuntu
|
||||
================================================================================
|
||||
One of routine tasks for system admins is to update installed programs with the latest patches and hotfixes, as well as upgrade software to a more recent release with new bells and whistles. The latest MySQL 5.6 was released early this year, targeting [better performance and scalability][1]. For those of you wanting to try out the latest bleeding edge MySQL, I will describe **how to upgrade MySQL server on Debian or Ubuntu**.
|
||||
|
||||
In this tutorial, I assume that you have already [set up MySQL with apt-get][2]. As of this writing, MySQL that ships with major Linux distros is version 5.5. Here I am going to demonstrate how to upgrade MySQL 5.5 to 5.6.
|
||||
|
||||
1.Back up your MySQL config files.
|
||||
|
||||
$ sudo mkdir /backup
|
||||
$ sudo tar cvfvz /backup/mysql_conf.tgz /etc/mysql
|
||||
|
||||
2.Export all databases to a .sql file, and back up MySQL data directory.
|
||||
|
||||
$ sudo sh -c 'mysqldump -u root -p -A --events > /backup/backup_db.sql
|
||||
$ sudo tar cvfvz /backup/mysql_data.tgz /var/lib/mysql
|
||||
|
||||
Note: for a consistent backup of a "live" MySQL system, it is recommended to use a single transaction option or explicit locks on the database, as detailed in [this tutorial][3].
|
||||
|
||||
3.Stop MySQL server.
|
||||
|
||||
$ sudo service mysql stop
|
||||
|
||||
4.Uninstall and remove MySQL packages.
|
||||
|
||||
$ sudo apt-get remove mysql-server mysql-client mysql-common
|
||||
$ sudo apt-get autoremove
|
||||
$ sudo apt-get autoclean
|
||||
|
||||
Do not use "purge" option in apt-get as that would remove MySQL config files and other MySQL related data directories as well, which we will continue to use after MySQL upgrade.
|
||||
|
||||
5.Install MySQL dependency (kernel asynchronous I/O access library) which is needed for MySQL 5.5 and higher.
|
||||
|
||||
$ sudo apt-get install libaio1
|
||||
|
||||
6.Download a MySQL Debian package from the official site.
|
||||
|
||||
On 32-bit system:
|
||||
|
||||
$ wget http://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.15-debian6.0-i686.deb
|
||||
|
||||
On 64-bit system:
|
||||
|
||||
$ wget http://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.15-debian6.0-x86_64.deb
|
||||
|
||||
7.Install the downloaded MySQL package.
|
||||
|
||||
$ sudo dpkg -i mysql-5.6.15-debian6.0-*.deb
|
||||
|
||||
The MySQL package will be installed under /opt/mysql directory.
|
||||
|
||||
8.Add the MySQL bin directory to the PATH variable system-wide.
|
||||
|
||||
On Debian:
|
||||
|
||||
$ sudo sh -c 'echo "PATH=$PATH:/opt/mysql/server-5.6/bin" >> /etc/profile'
|
||||
$ source /etc/profile
|
||||
|
||||
On Ubuntu or Linux Mint:
|
||||
|
||||
$ sudo sh -c 'echo "PATH=${PATH}:/opt/mysql/server-5.6/bin" >> /etc/environment'
|
||||
$ source /etc/environment
|
||||
|
||||
9.Open the MySQL config file with a text editor, and update the following two entries.
|
||||
|
||||
$ sudo vi /etc/mysql/my.cnf
|
||||
|
||||
> basedir = /opt/mysql/server-5.6
|
||||
> lc-messages-dir = /opt/mysql/server-5.6/share
|
||||
|
||||
10.Copy the MySQL startup script to /etc/init.d and install the script into the boot sequence, so that MySQL server starts up automatically upon boot.
|
||||
|
||||
$ sudo cp /opt/mysql/server-5.6/support-files/mysql.server /etc/init.d/mysql
|
||||
$ sudo update-rc.d mysql defaults
|
||||
|
||||
11.(Ubuntu-only) There is MySQL AppArmor profile created from the previous MySQL installation, which is not compatible with the new MySQL installation. So you need to reconfigure MySQL AppArmor profile so MySQL server can start.
|
||||
|
||||
First, create a symbolic link.
|
||||
|
||||
$ sudo ln -s /opt/mysql/server-5.6/bin/mysqld /usr/sbin/mysqld
|
||||
|
||||
Edit MySQL AppArmor profile.
|
||||
|
||||
$ sudo vi /etc/apparmor.d/usr.sbin.mysqld
|
||||
|
||||
> /opt/mysql/server-5.6/lib/plugin/ r,
|
||||
> /opt/mysql/server-5.6/lib/plugin/*.so* mr,
|
||||
> /opt/mysql/server-5.6/share/** r,
|
||||
|
||||
Reload AppArmor service.
|
||||
|
||||
$ sudo service apparmor restart
|
||||
|
||||
12.(Ubuntu-only) Remove a Upstart configuration for MySQL (which was installed as part of the previous MySQL installation). We will use SysVinit (/etc/init.d/mysql) instead.
|
||||
|
||||
$ sudo rm /etc/init/mysql.conf
|
||||
|
||||
13.Start MySQL server.
|
||||
|
||||
$ sudo service mysql start
|
||||
|
||||
14.Restore MySQL databases.
|
||||
|
||||
$ sudo mysql -u root -p < /backup/backup_db.sql
|
||||
|
||||
15. Finally, upgrade MySQL system tables.
|
||||
|
||||
$ sudo /opt/mysql/server-5.6/bin/mysql_upgrade -v -u root -p
|
||||
|
||||
### Troubleshooting MySQL Upgrade ###
|
||||
|
||||
If MySQL server fails to start with the following error on Ubuntu, this is because the old MySQL AppArmor profile prevents it from launching. To fix the problem, make sure to update the MySQL AppArmor profile as described in step 11.
|
||||
|
||||
Dec 20 19:57:48 ubuntu kernel: [ 5856.960592] type=1400 audit(1387598268.807:39): apparmor="STATUS" operation="profile_replace" name="/usr/sbin/mysqld" pid=25216 comm="apparmor_parser"
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://xmodulo.com/2013/12/upgrade-mysql-server-debian-ubuntu.html
|
||||
|
||||
译者:[译者ID](https://github.com/译者ID) 校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
|
||||
|
||||
[1]:http://dev.mysql.com/tech-resources/articles/whats-new-in-mysql-5.6.html
|
||||
[2]:http://xmodulo.com/2013/06/how-to-install-mysql-server-and-client-on-linux.html
|
||||
[3]:http://xmodulo.com/2012/10/how-to-backup-mysql-server.html
|
113
sources/Linux who command – Displays who is on the system.md
Normal file
113
sources/Linux who command – Displays who is on the system.md
Normal file
@ -0,0 +1,113 @@
|
||||
Linux who command – Displays who is on the system
|
||||
================================================================================
|
||||
As a system administrator, we need to ensure who is on the system on a particular time. We must keep on eye to our servers. But of course we can’t do that for 24 hours a day. On Linux system, we can use who command to see who is on the system
|
||||
|
||||
### What is who command ###
|
||||
|
||||
**who** command is a tool print information about users **who are currently logged in**. who command only see a real user who logged in. It won’t see a user that doing **su** command (switch user).
|
||||
|
||||
### How to use who command ###
|
||||
|
||||
On most Linux distribution, who command is already installed. To use it, just type who on your console. Running it without options will print a default output.
|
||||
|
||||
$ who
|
||||
|
||||
![](http://linoxide.com/wp-content/uploads/2013/12/who_default.png)
|
||||
|
||||
#### Here’s how to read the output : ####
|
||||
|
||||
- 1st column show the user name
|
||||
- 2nd column show how the user connected. Tty means the user is connected directly to the computer, while pts means the user is connected from remote
|
||||
- 3rd and 4th columns show the date and time
|
||||
- 5th column show the IP Address where the users are connected
|
||||
|
||||
### Using who command with options ###
|
||||
|
||||
Who command has some options to make the custom output. Here are some samples on day-to-day usage.
|
||||
|
||||
#### Indicate the time and date of the last reboot ####
|
||||
|
||||
To do this, use **-b** options
|
||||
|
||||
$ who -b
|
||||
|
||||
![](http://linoxide.com/wp-content/uploads/2013/12/who_b.png)
|
||||
|
||||
We can see that system was boot the computer on December 21st , 2013 at 3:52 PM
|
||||
|
||||
#### Indicate the current run-level of the init process ####
|
||||
|
||||
With -r option, who will print a current run-level of the init process.
|
||||
|
||||
$ who -r
|
||||
|
||||
![](http://linoxide.com/wp-content/uploads/2013/12/who_r.png)
|
||||
|
||||
The output show us that the current run-level on December 21st , 2013 at 3:52 PM was run-level 2.
|
||||
|
||||
#### Put header above every column ####
|
||||
|
||||
Use -H option to put a header above every column
|
||||
|
||||
$ who -H
|
||||
|
||||
![](http://linoxide.com/wp-content/uploads/2013/12/who_H.png)
|
||||
|
||||
#### Print only information about current terminal ####
|
||||
|
||||
We can use **-m** option to do this.
|
||||
|
||||
$ who -m
|
||||
|
||||
![](http://linoxide.com/wp-content/uploads/2013/12/who_m.png)
|
||||
|
||||
#### Count how many user that currently logged in ####
|
||||
|
||||
If you have many users logged in at the same time, this -q option will help you to count them.
|
||||
|
||||
$ who -q
|
||||
|
||||
![](http://linoxide.com/wp-content/uploads/2013/12/who_q.png)
|
||||
|
||||
#### Add idle time and PID information ####
|
||||
|
||||
By default, who will not print Idle Time and PID information. To add those information, use -u option. Don’t forget to use -H option to make it easier to read.
|
||||
|
||||
$ who -u -H
|
||||
|
||||
![](http://linoxide.com/wp-content/uploads/2013/12/who_u.png)
|
||||
|
||||
**The idle time** contains the number of hours and minutes since last activity occurred. So 00:13 means that user leni has been idle for 13 minutes. **The dot (.) sign** tell us that the terminal has seen activity on the last minute. During that time, we can call it “current”. **The PID** is a process ID of the user’s shell.
|
||||
|
||||
#### Show login process ####
|
||||
|
||||
To show it, we can use **-l** option.
|
||||
|
||||
$ who -l
|
||||
|
||||
![](http://linoxide.com/wp-content/uploads/2013/12/who_l.png)
|
||||
|
||||
The 1st column only show Login name which refer to System. The number 967, 971 etc on the screenshot above tell us the PID.
|
||||
|
||||
#### Display all the information ####
|
||||
|
||||
Using **-a** option will showing us all information. Here’s a sample.
|
||||
|
||||
$ who -a
|
||||
|
||||
![](http://linoxide.com/wp-content/uploads/2013/12/who_a.png)
|
||||
|
||||
#### Conclusion ####
|
||||
|
||||
You will found that who command is similar with [w command][1] in some ways. Don’t be confused about why Linux has some similar command in term its functionality. You can use what you think the best for you and suit the situation you are facing. Please consult to who manual page by typing man who from your console to explore it more detail.
|
||||
- See more at: http://linoxide.com/linux-command/linux-who-command/#sthash.CU0bq3e4.dpuf
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://linoxide.com/linux-command/linux-who-command/
|
||||
|
||||
译者:[译者ID](https://github.com/译者ID) 校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
|
||||
|
||||
[1]:http://linoxide.com/linux-command/linux-w-command/
|
@ -0,0 +1,80 @@
|
||||
look : Linux Command To Verify Spellings And Display Lines Beginning With A String
|
||||
================================================================================
|
||||
Have you ever felt the need of a command line utility in Linux through which you can verify spellings? A utility that can display lines in file which contain a particular string as a prefix? Well, in this article we will discuss the **look** command in Linux that is capable of doing both these tasks.
|
||||
|
||||
### look Command In Linux ###
|
||||
|
||||
Here is a snapshot of the description of look command from its man page :
|
||||
|
||||
![](http://mylinuxbook.com/wp-content/uploads/2013/12/look-main.png)
|
||||
|
||||
### Testing Environment ###
|
||||
|
||||
- **OS** – Ubuntu 13.04
|
||||
- **Shell** – Bash 4.2.45
|
||||
- **Application** – look 2.20.1-5.1ubuntu8
|
||||
|
||||
#### A Brief Tutorial ####
|
||||
|
||||
Now lets discuss this command through some practical examples.
|
||||
|
||||
Suppose you want to verify the spelling of the word rendezvous. You can do it easily using look command.
|
||||
|
||||
Here is an example :
|
||||
|
||||
$ look rendez
|
||||
rendezvous
|
||||
rendezvous's
|
||||
rendezvoused
|
||||
rendezvouses
|
||||
rendezvousing
|
||||
|
||||
So as you can see, I just passed a few initial characters of the word as command line argument and the command produced all the related words. These words are fetched by the look command from the file **/usr/share/dict/words**.
|
||||
|
||||
Another scenario could be the one in which it is required to print all the lines beginning with a particular string. For example, if I want to display all the header files that are included in a c file, I’d use the look command in the following way :
|
||||
|
||||
$ look "#include" efence_test.c
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
So you can see that it produced all the lines in file efence_test.c that begin with the string “#include” and hence I got to know the header files included in this source file.
|
||||
|
||||
By default, all the matching that the look command does is case-sensitive. You can opt for non-case-sensitive matching by using the **-f option**.
|
||||
|
||||
Here are some other command line options that the look command provides :
|
||||
|
||||
![](http://mylinuxbook.com/wp-content/uploads/2013/12/look-options.png)
|
||||
|
||||
For more information on this command, read its [man page][1].
|
||||
|
||||
#### Download/Install/Configure ####
|
||||
|
||||
Here are some of the important links related to the look command :
|
||||
|
||||
- Home Page [*Let me know if you find home page of this utility*]
|
||||
- Download Link
|
||||
|
||||
The look command comes as a part of **util-linux** package which is pre-installed in most of the Linux distributions.
|
||||
|
||||
#### Pros ####
|
||||
|
||||
- Easily verify spellings from command line
|
||||
- Comes pre-installed in most of the Linux distributions
|
||||
|
||||
#### Cons ####
|
||||
|
||||
- Depends on /usr/share/dict/words for spelling verification.
|
||||
|
||||
#### Conclusion ####
|
||||
|
||||
An excellent command line utility to verify spellings. Saves a lot of time if you want to display lines beginning with a particular string. Try it, you’ll definitely like it.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://mylinuxbook.com/look-verify-spellings-and-display-lines/
|
||||
|
||||
译者:[译者ID](https://github.com/译者ID) 校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
|
||||
|
||||
[1]:http://linux.about.com/library/cmd/blcmdl1_look.htm
|
Loading…
Reference in New Issue
Block a user