Posts

How to change AWS Linux AMI2 hostname

As a best practice, it is recommended to change the system hostname according to project infrastructure inventory. User-friendly hostname provides us ability to quickly identify the system components of the project easily. Login to the system with ec2-user sudo hostnamectl set-hostname aws-mgmt Successfully updated hostname [ec2-user@ aws-mgmt   ~]$ Reference:  https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/set-hostname.html

How to resize VM disk size

This note provides steps to resize the KVM based VM images. In this situation, VM disk is raw format and filesystem is ext4. Expand disk size In order to expand disk size, VM must be shutdown Increase raw disk size qemu-img resize vm-1.img +10G Resize partition virt-rescue -a vm-1.img At rescue environment ><rescue> fdisk /dev/sdx Use normal fdisk command to delete partition and re-create the partition with bigger size. For this case, I would like to expand /dev/sda3 to have additional 10G ><rescue> fdisk /dev/sda d (select 3 to delete parition sda3) n (create new partition) select as primary select default start and end w (save the changes and exit from fdisk menu) ><rescue> e2fsck -f /dev/sda3 ><rescue> resize2fs /dev/sda3 ><rescue> sync ><rescue> exit I selected default start and end of disk because I want to use the rest of disk spac...

VM image and network configuration at OpenStack environment

This note focuses on VM image and network manipulation at OpenStack environment Glance is the image service in OpenStack envrionment Create CentOS7 image glance image-create --name centos7-64 --file CentOS-7-x86_64-GenericCloud-1706.qcow2 --disk-format qcow2 --container-format bare --progres Default image directory /var/lib/glance/images/ You may want to convert raw disk to qcow2 qemu-img convert -f raw -O qcow2 vm-1.img vm-1.qcow2 Edit config parameter for Glance /etc/glance/glance-api.conf Restart Glance service to take effect of changes systemctl restart openstack-glance-api Neutron is network service at OpenStack environment Create network neutron net-create Custom-network --provider:network_type flat --provider:physical_network externalnet --router:external=True --shared neutron subnet-create --name external_subnet --enable_dhcp=False --allocation_pool start=192.168.1.10,end=192.168.1.250 --gateway=192.168.1.1 --dns 8.8.8.8 External-network 192.168.1.0/...

How to setup Kimchi(Wok) for management of KVM host

This note provides steps how to install kimchi(wok) for management of KVM virtualization Install Centos7 with Minimal installation Update system to up to date yum update -y Install KVM yum -y install qemu-kvm libvirt virt-install bridge-utils bind-utils virt-manager wget net-tools virt-viewer genisoimage epel-release Make sure KVM start upon reboot systemctl start libvirtd systemctl enable libvirtd Download Kimchi project installers wget https://github.com/kimchi-project/kimchi/releases/download/2.5.0/kimchi-2.5.0-0.el7.centos.noarch.rpm wget https://github.com/kimchi-project/kimchi/releases/download/2.5.0/wok-2.5.0-0.el7.centos.noarch.rpm wget http://kimchi-project.github.io/gingerbase/downloads/latest/ginger-base.el7.centos.noarch.rpm wget http://kimchi-project.github.io/ginger/downloads/latest/ginger.el7.centos.noarch.rpm Install RPMs yum localinstall * Start service systemctl enable wokd systemctl start wokd Allow firewall firewall-cmd --zone=public --pe...

How to setup KVM host and manage guest operation systems

This note provides steps how to install KVM and manage Guest OS with virsh. Install KVM yum -y install qemu-kvm libvirt virt-install bridge-utils bind-utils virt-manager wget net-tools virt-viewer genisoimage epel-release Install Guest OS from installer iso image virt-install --name VM-1 --ram 4096 --disk path=/testvm/VM-1.qcow2,size=40 --vcpus 2 --os-type linux --os-variant rhel6 --network bridge=br0 --graphics none --console pty,target_type=serial --cdrom /iso/CentOS-6.8-x86_64-bin-DVD1.iso --force Default directory for intalled VM /var/lib/libvirt/images/ Dump VM config into xml virsh dumpxml VM-1 > VM-1.xml Useful operation commands Create and start VM virsh define VM-1.xml virsh start VM-1 Shutdown VM virsh shutdown VM-1 Poweroff VM virsh destroy VM-1 Remove from VM list virsh undefine VM-1 Resize VM disk size qemu-img resize VM-1.img +60GB

OpenSSL for Self-Signed Certificate Authority

This note provides how to setup self-signed certificate authority with OpenSSL. Generate CA Certificate openssl genrsa -des3 -out cloudtalents-ca.key 2048 openssl req -new -x509 -days 3650 -key cloudtalents-ca.key -out cloudtalents-ca.crt Sign Server Certificate with CA certificate that generated earlier Server key openssl genrsa -out cloudtalents-server.key 2048 Certificate request openssl req -new -out cloudtalents-server.csr -key cloudtalents-server.key Sign openssl x509 -req -in cloudtalents-server.csr -days 1825 -sha1 -CAcreateserial -CA cloudtalents-ca.crt -CAkey cloudtalents-ca.key -out cloudtalents-server.crt

Setting up GIT server

This note provides how to setup private GIT repository server. Server setup Install git yum install git Create user useradd gitacc passwd gitacc Create ssh directory mkdir .ssh && chmod 700 .ssh touch .ssh/authorized_keys && chmod 600 .ssh/authorized_keys Create key to authenticate ssh-keygen -C "youremail@mailprovider.com" Create entries of public keys for allow users cat .ssh/id_rsa.pub | ssh user@123.45.56.78 "cat >> ~/.ssh/authorized_keys" Create project repository at server cd /home/gitacc mkdir "project" cd "project" git init --bare Client configuration Change to working directory cd "project" git init git add . git commit -m 'initial commit' git remote set-url origin gitacc@128.199.136.183:mt/mt-project.git git init git remote add origin gitacc@128.199.136.183:mt/mt-project.git Commit new file git add test.txt git commit -m 'created test.txt' git push origin...