Tuesday, July 30, 2013

Install license for parallel cloud server

parallel cloud server user guide:

http://www.parallels.com/fileadmin/parallels/documents/hosting-cloud-enablement/pcs/Production_Documents/Update_2/Parallels_Cloud_Server_User_s_Guide_03262013.pdf


nstalling the License
Depending on the way you have obtained your Parallels Cloud Server license, the process of
installing the license slightly differs:
• If you have obtained the license in the form of a product key, you can install it on the server
using the -p option of the vzlicload command. For example, you can execute the following
command to install the XXXXXX-XXXXXX-XXXXXX-XXXXXX-XXXXXX product key:
# vzlicload -p XXXXXX-XXXXXX-XXXXXX-XXXXXX-XXXXXX
Note: You can also use the vzlicload utility to upgrade the license. For example, this may be
necessary if your current license does not support using Parallels Virtual Automation for managing
Parallels servers.
• If you have obtained the license in the form of an activation code, you can install it on the server
using the -a option of the vzlicupdate command. For example:
# vzlicupdate -a XXXXXX-XXXXXX-XXXXXX-XXXXXX-XXXXXX
where XXXXXX-XXXXXX-XXXXXX-XXXXXX-XXXXXX is your activation code. When executed,
vzlicupdate connects to the Parallels Key Authentication (KA) licensing server and transmits
the specified activation code there. The licensing server, in turn, generates a license file, sends it
back to the server from where the activation code has been dispatched, and automatically
installs it on this server. So, before executing the aforementioned command, make sure that
your Parallels server is connected to the Internet.
If you are activating your installation by means of an activation key, you must have an active Internet
connection to successfully complete the license installation. Otherwise, you will be presented with
the corresponding warning message informing you of the steps you have to take to activate your
license. As a rule, these steps are the following:
1 Visiting the http://www.parallels.com/en/support/virtuozzo/activate web page and activating the
license manually.
2 Providing the following information on this web page:
• In the Product Code field, specify your license activation code.
• In the HWID field, provide the ID of your server.
• In the Enter following digits field, type the digits displayed next to this field.
3 Clicking the ACTIVATE LICENSE button.
If you have entered the correct information on the Virtuozzo License Activation page, you will be
provided with a link to a license file that you should download to and install on the server. For
example, you can run this command to install the obtained license file
# vzlicload -f /etc/vzlicense
This command will install the license file with the name of vzlicense on your server.

Thursday, July 25, 2013

Find out if CPU supports hardware vitualization Intel VT-X or AMD-V

grep --color vmx /proc/cpuinfo

or 

# grep --color svm /proc/cpuinfo


http://www.cyberciti.biz/faq/linux-xen-vmware-kvm-intel-vt-amd-v-support/

Monday, July 22, 2013

Tips of bibliography in Latex

include bibliography in main.tex

\bibliographystyle{abbrv}
\bibliographystyle{acm}
\bibliographystyle{plain}
\bibliographystyle{IEEEtran}  

\bibliography{bibliography/biosbib}

URL: 

You can put it in URL field, but it only shows on IEEE format (IEEEtran), it does not show up for other format. You have to move url to HowPublished field.

For example:
\url{www.windbg.org}

Please remember to include \usepackage{url} in the main.tex

Misc:

Sometimes, you don't know the author of the reference, and the author is a group name. In this case, you need to add a curly brace out side of the group name, and the bibtex will not threat it as human names.

For example:
@MISC{tboot,
  author = {{Trust Computing Group}},
  title = {{Trusted Boot}},
  howpublished = {\url{http://www.trustedcomputinggroup.org/resources/trusted_boot}},
  owner = {fengwei},
  timestamp = {2013.05.03}
}

If you don't add curly brace, it will treat the word "group" as the last name, and order the reference based on that.


Thursday, July 18, 2013

Assembly Tip

It look like we should not use memory address directly in Assembly. Let's take a look at following example:

movl $0xA9000, %ebx
rdtsc
movl %eax, (%ebx)
movl %edx, 4(%ebx)

It stores the TSC value to memory location 0xA9000.
If I use the memory location directly in the assembly, the code willl not work. 

rdtsc
movl %eax, 0xA9000
movl %edx, 0xA9004




Access MSR (memory specific register) on Linux

msr-tool

https://www.kernel.org/pub/linux/utils/cpu/msr-tools/

After download the tool, cd into the folder and do $make

Usage:
./rdmsr [ADDRESS]
./rdmsr [ADDRESS] [DATA]

If you have following error:
rdmsr:open: No such file or directory

Load the msr module
$modprobe msr

http://linux.koolsolutions.com/2009/09/19/howto-using-cpu-msr-tools-rdmsrwrmsr-in-debian-linux/


Friday, July 12, 2013

OpenVZ live migration

OpenVZ has its own migration tool: vzmigrate
Usage:
vzmigrate --live -t REMOTE_IP CONTAINER_ID

More detail: $man vzmigrate

A paper describe how it works: 
http://www.landley.net/kdocs/ols/2008/ols2008v2-pages-85-90.pdf

Tuesday, July 9, 2013

Basic Commands of OpenVZ

$ vzlist
list all of the active containers

$vzctl start 101
$vzctl stop 101
$vzctl restart 101

$vzctl destroy 101
$vzct enter 101

More: http://openvz.org/Basic_operations_in_OpenVZ_environment

[root@sr1s1 ~]# vz
vzcalc         vzcpucheck     vzdqdump       vzifup-post    vzmigrate      vzpid          vzstats      
vzcfgvalidate  vzctl          vzdqload       vzlist         vznetaddbr     vzquota        vzubc        
vzcptcheck     vzdqcheck      vzeventd       vzmemcheck     vznetcfg       vzsplit      


$ vzctl exec 101 ps -ef
See more on man vzctl

Wednesday, July 3, 2013

Enable networking in VENET OpenVZ container

I followed the instruction from OpenVZ website fo quickly create an VENET container, but it took me a while to enable networking.
Environment: CentOS 6.4 as the server, and try to create an centos-6-x86_64 container

Here is the instruction from OpenVZ website:

https://openvz.org/Quick_Installation_CentOS_6

Create a VENET Container

  • Create a CT
# vzctl create 101 --ostemplate centos-6-x86_64 --config vswap-1g
  • Configure the CT
# vzctl set 101 --save --name server101
# vzctl set 101 --save --onboot yes
# vzctl set 101 --save --hostname server101.example.com
# vzctl set 101 --save --ipadd 192.168.1.101
# vzctl set 101 --save --searchdomain example.com
# vzctl set 101 --save --nameserver 8.8.8.8 --nameserver 8.8.4.4
# vzctl set 101 --save --cpus 4
# vzctl set 101 --save --ram 8G
# vzctl set 101 --save --swap 4G
# vzctl set 101 --save --diskspace 100G
# vzctl start 101
# vzctl exec 101 passwd
  • Done. Enjoy your new VENET container



The instruction is correct, but there are 3 things you may want to pay attention.

1. set up a correct nameserver.
If you are setting up a real server, you can use command $dhclient, and it automatically identify the nameservers and write them into /etc/resovl.conf file. In OpenVZ container, we need to set it up manually.

2. use a correct IP.
In my case, I followed the instruction, and use IP address as 192.168.1.101, which causes me problem to connect to internet in the container. Then, I changed the IP address to 192.168.0.101, and the container can ping google successfully. I think this is because there are internal setting in my subnet, and they may have some IP restrictions.

3. set up a correct IP tables in host node.
Because I used Cent OS 6.4 as my host server, it has IP tables firewall enabled. One simpler solution is to run command $ iptables --flush, it clean all of the IP table rules, but it comes back after reboot. If you want to permanetly change the iptable settings, you need to add a rule to allow the connection from the container to the Internt.

Additionally, take read this page: https://openvz.org/Common_Networking_HOWTOs
My experiments have been working with private IP inaccessible from LAN (case 1) and public static IP accessible from the same LAN (case 2).

Note that, we need to change the interface name (run ifconfig to see which interface that connections to the outside on host) to run this command that enables ping google from the containers.
[host-node]# iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE

Tuesday, July 2, 2013

Generate SSH public key authentication

$ ssh-keygen
You can just press enter to create a rsa key pair;
.ssh/id_rsa is your priviate key stays in this machine
.ssh/id_rsa.pub is the public key you need to copy to the remote machine
I would suggest to use a passphrase, which only need to enter once for each OS boot

$ ssh-copy-id username@remote.machine.com
It copies the public key from local machine to a remote machine, and stores it at .ssh/authorized_key file


Monday, July 1, 2013

Some commands related to networking on Linux

Network Device Up and Down
$ service network restart
$ /etc/init.d/network restart

$ service network start
$ service network stop

$ifdown eth0
$ifup eth0

$ ifconfig

$ dhclient

Name Server
$ vim /ect/resolv.conf
[root@sr1s1 ~]# cat /etc/resolv.conf
# Generated by NetworkManager
nameserver 129.174.97.3
nameserver 129.174.68.227
nameserver 129.174.1.3

HostName
$ echo hostname=$HOSTNAME >> /etc/sysconfig/network
set hostname

Routing Table
$ route
show the routing tables

IP Table
$ iptables --list
view all of the ip table rules

Opening Ports
$lsof -i

Start SSH
$ service sshd restart

Automatically Start SSH on Boot
$ chkconfig --level 5 --del sshd
$ chkconfig --level 5 --add sshd

Query system running service
$ chkconfig

Update bashrc or profile
$ source ~/.profile