20141029-1 选题

This commit is contained in:
DeadFire 2014-10-29 13:09:25 +08:00
parent dbfd0fbbd4
commit ae3d7383d0
5 changed files with 358 additions and 0 deletions

View File

@ -0,0 +1,52 @@
How to Install MariaDB in Ubuntu 14.04 LTS
================================================================================
MariaDB is an Open Source database Server & It is 100 % compatible with MySQL, drop-in replacement to MySQL database server.
### Background of MariaDB : ###
In 2008, MySQL was acquired by **Sun Microsystems**, which was in turn acquired by Oracle Corporation in 2010. While the initial acquisition by Sun was hailed by many in the MySQL community as exactly what the project needed, that sentiment did not last, and the subsequent acquisition by Oracle was unfortunately met with far lower expectations. Many of MySQLs developers left Sun and Oracle to work on new projects . Among them was **Michael Monty Widenius**, creator of MySQL and one of the projects longtime technical lead. Monty and his team created a fork (offshoot) of the MySQL code base and named his new DBMS **MariaDB**
In this Post we will discuss how to install MariaDB in Ubuntu Linux. By default mariadb packages are not included in Ubuntu Repositories. So to install mariadb , we we have set MariaDB repository.
#### Setting Up MariaDB Repository ####
$ sudo apt-get install software-properties-common
$ sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xcbcb082a1bb943db
$ sudo add-apt-repository 'deb http://sfo1.mirrors.digitalocean.com/mariadb/repo/10.0/ubuntu trusty main'
#### Installation of MariaDB : ####
$ sudo apt-get update
$ sudo apt-get install mariadb-server
While Installing MariaDB , you will be asked to set Maria DB root Password.
![](http://www.linuxtechi.com/wp-content/uploads/2014/10/mariadb-root-1024x442-1.jpg)
#### Connect To MariaDB From the Command Line : ####
linuxtechi@mail:~$ mysql -uroot -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 40
Server version: 10.0.14-MariaDB-1~trusty-log mariadb.org binary distribution
Copyright (c) 2000, 2014, Oracle, SkySQL Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]>
#### Maria DB Service ####
$ sudo /etc/init.d/mysql stop
$ sudo /etc/init.d/mysql start
--------------------------------------------------------------------------------
via: http://www.linuxtechi.com/install-mariadb-in-ubuntu/
作者:[Pradeep Kumar][a]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
[a]:http://www.linuxtechi.com/author/pradeep/

View File

@ -0,0 +1,40 @@
Linux FAQs with Answers--How to fix “hda-duplex not supported in this QEMU binary”
================================================================================
> **Question**: When I try to install Linux on a new VM in virt-manager, the VM fails to boot with the following error: "unsupported configuration: hda-duplex not supported in this QEMU binary." How can I fix this error?
The cause for this VM error may originate from a qemu bug where a configured default sound card model is not recognized.
![](https://farm4.staticflickr.com/3935/15000012754_b8b147fb16_o.png)
Unable to complete install: 'unsupported configuration: hda-duplex not supported in this QEMU library'
To solve this problem, do the following.
### Solution One: Virt-Manager ###
On **virt-manager**, open the VM's virtual hardware details menu, go to sound device section, and change the device model from default to ac97.
![](https://farm4.staticflickr.com/3956/15435183020_d97856170c_z.jpg)
Click on "Apply" button to save the change. See if you can start the VM now.
### Solution Two: Virsh ###
If you are using **virsh**, not **virt-manager**, you can edit the VM's XML file accordingly. Look for **sound** section inside <device> section, and change the sound model to **ac97** as follows.
<devices>
. . .
<sound model='ac97'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
</sound>
. . .
</device>
--------------------------------------------------------------------------------
via: http://ask.xmodulo.com/hda-duplex-not-supported-in-this-qemu-binary.html
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出

View File

@ -0,0 +1,52 @@
Linux FAQs with Answers--How to install REMI repository on CentOS or RHEL
================================================================================
> **Question**: How can I configure the REMI repository on CentOS or RHEL, and install packages from the REMI repository?
The [REMI repository][1] offers updated versions of core CentOS and RHEL packages, notably the latest PHP/MySQL stack.
One thing to remember before installing the REMI repository is that it is not recommended to run yum update with the REMI repository. Since the package names of the REMI repository are the same as those used in the official RHEL/CentOS repositories, running yum update may trigger accidental upgrades of core packages. It is a good idea to keep the REMI repository disabled, and enable it only when you need to install packages that are only available in REMI.
### Prerequisite ###
Before installing REMI repository, you first need to enable the EPEL repository because some packages in REMI depend on EPEL. Follow [this guide][2] to set up EPEL repository on CentOS or RHEL.
### Install REMI Repository ###
Now go ahead and install REMI repository as follows.
On CentOS 7:
$ sudo rpm --import http://rpms.famillecollet.com/RPM-GPG-KEY-remi
$ sudo rpm -ivh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
On CentOS 6:
$ sudo rpm --import http://rpms.famillecollet.com/RPM-GPG-KEY-remi
$ sudo rpm -ivh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
By default, the REMI repository is set disabled. To check whether the REMI repository is successfully installed, use this command. You will see several REMI repositories such as remi, remi-php55 and remi-php56.
$ yum repolist disabled | grep remi
![](https://farm4.staticflickr.com/3956/15443851690_a1abe9eb40_z.jpg)
### Install a Package from REMI Repository ###
As clarified, it is a good idea to keep the REMI repository disabled, and use it only when necessary.
To search or install a package in the REMI repository, use these commands:
$ sudo yum --enablerepo=remi search <keyword>
$ sudo yum --enablerepo=remi install <package-name>
--------------------------------------------------------------------------------
via: http://ask.xmodulo.com/install-remi-repository-centos-rhel.html
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
[1]:http://rpms.famillecollet.com/
[2]:http://xmodulo.com/how-to-set-up-epel-repository-on-centos.html

View File

@ -0,0 +1,68 @@
Linux FAQs with Answers--How to open a port in the firewall on CentOS or RHEL
================================================================================
> **Question**: I am running a web/file server on my CentOS box, and to access the server remotely, I need to modify a firewall to allow access to a TCP port on the box. What is a proper way to open a TCP/UDP port in the firewall of CentOS/RHEL?
Out of the box, enterprise Linux distributions such as CentOS or RHEL come with a powerful firewall built-in, and their default firewall rules are pretty restrictive. Thus if you install any custom services (e.g., web server, NFS, Samba), chances are their traffic will be blocked by the firewall rules. You need to open up necessary ports on the firewall to allow their traffic.
On CentOS/RHEL 6 or earlier, the iptables service allows users to interact with netfilter kernel modules to configure firewall rules in the user space. Starting with CentOS/RHEL 7, however, a new userland interface called firewalld has been introduced to replace iptables service.
To check the current firewall rules, use this command:
$ sudo iptables -L
![](https://farm6.staticflickr.com/5601/15604533686_a8c0ae7b89_z.jpg)
Now let's see how we can update the firewall to open a port on CentOS/RHEL.
### Open a Port on CentOS/RHEL 7 ###
Starting with CentOS and RHEL 7, firewall rule settings are managed by firewalld service daemon. A command-line client called firewall-cmd can talk to this deamon to update firewall rules permanently.
To open up a new port (e.g., TCP/80) permanently, use these commands.
$ sudo firewall-cmd --zone=public --add-port=80/tcp --permanent
$ sudo firewall-cmd --reload
Without "--permanent" flag, the firewall rule would not persist across reboots.
### Open a Port on CentOS/RHEL 6 ###
On CentOS/RHEL 6 or earlier, a iptables service is responsible for maintaining firewall rules.
Use iptables command to open up a new TCP/UDP port in the firewall. To save the updated rule permanently, you need the second command.
$ sudo iptables -I INPUT -p tcp -m tcp --dport 80 -j ACCEPT
$ sudo service iptables save
Another way to open up a port on CentOS/RHEL 6 is to use a terminal-user interface (TUI) firewall client, named system-config-firewall-tui.
$ sudo system-config-firewall-tui
Choose "Customize" button in the middle and press ENTER.
![](https://farm6.staticflickr.com/5602/15628237745_4409cff52f_z.jpg)
If you are trying to update the firewall for any well-known service (e.g., web server), you can easily enable the firewall for the service here, and close the tool. If you are trying to open up any arbitrary TCP/UDP port, choose "Forward" button and go to a next window.
![](https://farm4.staticflickr.com/3941/15604533696_12857827ea_z.jpg)
Add a new rule by choosing "Add" button.
![](https://farm4.staticflickr.com/3941/15008065383_4b92cbd843_z.jpg)
Specify a port (e.g., 80) or port range (e.g., 3000-3030), and protocol (e.g., tcp or udp).
![](https://farm4.staticflickr.com/3946/15007474154_bef75d8c72_z.jpg)
Finally, save the updated configuration, and close the tool. At this point, the firewall will be saved permanently.
![](https://farm4.staticflickr.com/3942/15628237765_0299a638ab_z.jpg)
--------------------------------------------------------------------------------
via: http://ask.xmodulo.com/open-port-firewall-centos-rhel.html
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出

View File

@ -0,0 +1,146 @@
Shell Scripting Checking Conditions with if
================================================================================
In Bourne Shell if statement checks whether a condition is true or not. If so , the shell executes the block of code associated with the if statement. If the statement is not true , the shell jumps beyond the end of the if statement block & Continues on.
### Syntax of if Statement : ###
if [ condition_command ]
then
command1
command2
……..
last_command
fi
#### Example: ####
#!/bin/bash
number=150
if [ $number -eq 150 ]
then
echo "Number is 150"
fi
#### if-else Statement : ####
In addition to the normal if statement , we can extend the if statement with an else block. The basic idea is that if the statement is true , then execute the if block. If the statement is false , then execute the else block.
#### Syntax : ####
if [ condition_command ]
then
command1
command2
……..
last_command
else
command1
command2
……..
last_command
fi
#### Example: ####
#!/bin/bash
number=150
if [ $number -gt 250 ]
then
echo "Number is greater"
else
echo "Number is smaller"
fi
### If..elif..else..fi Statement (Short for else if) ###
The Bourne shell syntax for the if statement allows an else block that gets executed if the test is not true. We can nest if statement , allowing for multiple conditions. As an alternative, we can use the elif construct , shot for else if.
#### Syntax : ####
if [ condition_command ]
then
command1
command2
……..
last_command
elif [ condition_command2 ]
then
command1
command2
……..
last_command
else
command1
command2
……..
last_command
fi
#### Example : ####
#!/bin/bash
number=150
if [ $number -gt 300 ]
then
echo "Number is greater"
elif [ $number -lt 300 ]
then
echo "Number is Smaller"
else
echo "Number is equal to actual value"
fi
### Nested if statements : ###
If statement and else statement can be nested in a bash script. The keyword fi shows the end of the inner if statement and all if statement should end with the keyword fi.
Basic **syntax of nested** if is shown below :
if [ condition_command ]
then
command1
command2
……..
last_command
else
if [ condition_command2 ]
then
command1
command2
……..
last_command
else
command1
command2
……..
last_command
fi
fi
#### Example: ####
#!/bin/bash
number=150
if [ $number -eq 150 ]
then
echo "Number is 150"
else
if [ $number -gt 150 ]
then
echo "Number is greater"
else
echo "'Number is smaller"
fi
fi
--------------------------------------------------------------------------------
via: http://www.linuxtechi.com/shell-scripting-checking-conditions-with-if/
作者:[Pradeep Kumar][a]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
[a]:http://www.linuxtechi.com/author/pradeep/