Build an Ubuntu server test environment

Source: Internet
Author: User
Tags ssh server install redis

Objectives:

Now there are many very powerful open-source server components in Linux, such as redis, memcached, rabbitmq, MongoDB, and hadoop, which are worth studying. Therefore, we are ready to start a Ubuntu virtual machine, install these services for external call testing.

 

Step 1: Use hyper-V in Windows Server 2k8r2 as the VM host, because my computer only has a wireless Nic, and hyper-V does not support using a wireless Nic as the NIC by default, therefore, you need to do the following:

First, there is an internal only virtual network in the virtual network manger:

Then, on the Network Connections panel, create a bridge connection between the wireless network adapter and the new virtual network device, as shown in:

In this way, even if the Virtual Machine network is set up, the installation of ubuntu server will begin.

Step 2: configure the Ubuntu server.

1. Set the Virtual Machine name and storage location

2. Set the memory size of the VM.

3. Set the NIC used by the VM to the added virtual Internet connection.

4. Set the hard disk for the Virtual Machine System. The virtual hard disk created by hyper-V by default will increase according to the actual usage and will not be specified at the beginning.

5. Install the system for the virtual machine, mount the Ubuntu Server installation disk, here I select ubuntu-11.10-server-amd64.iso, and then this completes the basic configuration of the virtual machine.

Step 3: Install Ubuntu server on the VM.

1. Start the VM and enter the installation interface. First, select the language type of the installation prompt. For better compatibility, select English

2. Next, a specific installation prompt will appear. Simply press enter and select install Ubuntu server.

3. Select the default system language, English, and United States as the country.

4. When configure the network, the system will prompt that the network card cannot be found. Click to continue installation.

5. Set a machine name for the Ubuntu server of the VM:

6. Set the time zone and select Chongqing in Asia.

7. Set the disk partition of the Ubuntu server and select the default guided-use entire disk and set up LVM. Select Yes and the default values in the next steps.

8. After the Basic installation is complete, the installation wizard requires you to enter an account for daily use. (System admin is the user name, SA is the account ID, and the password is 1234)

9. Check whether the next home directory is encrypted and no, HTTP proxy is empty, and the upgrade is not automatically updated.

10. Check Open SSH server and lamp server for the installation and selection of additional software. Then, wait for a moment to complete the preliminary installation of ubuntu server.

Step 4: configure the Ubuntu server environment.

1. You must first configure the IP address and DNS of the Ubuntu server.

The network configuration information of Ubuntu is stored in/etc/Network/interfaces, while the DNS information is in/etc/resolv. conf.

First, use Sudo-s to switch to the root user, and then use nano/etc/Network/interfaces and nano/etc/resolv. the conf command sets the IP address and DNS respectively, and finally uses/etc/init. d/networking restart application IP address and DNS.

You can use the ifconfig command and ping command to verify the configuration.

2. because OpenSSH and lamp have been selected in the installation phase, you can access the Apache server in the virtual machine in the browser of the host machine to verify that they work properly; you can also use pietty and other SSH terminals to connect to the virtual machine.

3. Execute sudo apt-Get update to update the current Ubuntu server. This may take 10 minutes.

4. Run sudo apt-Get install build-essential to install the basic compiling environment.

5. Now we can start to install more Linux services.

Step 5: Install redis

1. Visit the download page http://redis.io/download on the official website, you can find an example of installation commands similar to the following in the installation section below, and then execute the following command in the Ubuntu server environment:

 
$ Wget http://redis.googlecode.com/files/redis-2.4.tar.gz$ tar xzf redis-2.4.4.tar.gz $ CD redis-2.4.4 $ make $ sudo make install

2. Configure the init STARTUP script. The command line is as follows:

 
$ Wget https://github.com/ijonas/dotfiles/raw/master/etc/init.d/redis-server$ sudo MV redis-server/etc/init. d/redis-server $ sudo MV redis. CONF/etc/redis. conf
 
$ Sudo useradd redis
$ Sudo mkdir-P/var/lib/redis
 
$ Sudo mkdir-P/var/log/redis
 
$ Sudo chown redis. redis/var/lib/redis
 
$ Sudo chown redis. redis/var/log/redis

3. Modify the redis. conf file. The main modification points are:

# Whether to run as a background service. The default value is no.
Daemonize Yes
# How long will the client time out when it is idle? The default value is 0 (that is, it never expires)
Timeout 300
# Set the log file location. The default value is the stdout file in the running directory.
Logfile/var/log/redis. Log
# Set the data file storage directory./by default ./
DIR/var/lib/redis
 

4. Set redis to start, start redis, and verify

Sudo Update-rc.d redis-server ults

 
Sudo/etc/init. d/redis-Server start
 
Connect to the server using redis-cli for testing
 
As shown in the following figure:

(To be continued)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.