lost and found ( for me ? )

Showing posts with label Fedora 20. Show all posts
Showing posts with label Fedora 20. Show all posts

Fedora 20 : install Go 1.2 lang

Reference

# cat /etc/fedora-release ;uname -ri
Fedora release 20 (Heisenbug)
3.13.0-1.vanilla.mainline.knurd.1.fc20.x86_64 x86_64

untar file and store these file under /usr/local/go directory
# tar -C /usr/local -xzf go1.2.linux-amd64.tar.gz

# ls /usr/local/go
AUTHORS       LICENSE  README   api  blog  favicon.ico  lib   pkg         src
CONTRIBUTORS  PATENTS  VERSION  bin  doc   include      misc  robots.txt  test



# export PATH=$PATH:/usr/local/go/bin

# which go
/usr/local/go/bin/go

# go version
go version go1.2 linux/amd64

make a go file
# cat hello.go
package main

import "fmt"

func main() {
   fmt.Print("hello\n")
}

run
# go run hello.go
hello

Fedora 20: build a VM with virt-builder

Here are trial and error logs when building VMs for KVM by using virt-builder

reference
http://libguestfs.org/virt-builder.1.html

[root@f20 ~]# cat /etc/fedora-release
Fedora release 20 (Heisenbug)
[root@f20 ~]# uname -ri
3.13.0-0.rc8.git2.1.vanilla.mainline.knurd.1.fc20.x86_64 x86_64
[root@f20 ~]# qemu-system-x86_64 --version
QEMU emulator version 1.7.0, Copyright (c) 2003-2008 Fabrice Bellard

virt-builder includes libguest-tools.
# yum install libguestfs-tools

# libguestfs-test-tool --version
libguestfs-test-tool 1.24.4fedora=20,release=1.fc20,libvirt

list OSes you can build
# virt-builder --list
virt-builder: warning: cache /root/.cache/virt-builder: Unix.Unix_error(20, "mkdir", "/root/.cache/virt-builder")
virt-builder: disabling the cache
centos-6                 CentOS 6.5
cirros-0.3.1             CirrOS 0.3.1
debian-6                 Debian 6 (Squeeze)
debian-7                 Debian 7 (Wheezy)
fedora-18                Fedora® 18
fedora-19                Fedora® 19
fedora-20                Fedora® 20
scientificlinux-6        Scientific Linux 6.4
ubuntu-10.04             Ubuntu 10.04 (Lucid)
ubuntu-12.04             Ubuntu 12.04 (Precise)
ubuntu-13.10             Ubuntu 13.10 (Saucy)

build a Fedora20 VM
error.
# virt-builder fedora-20 --root-password file:./rootpw.txt -o f20-vm.qcow2 --format qcow2 --size 20G --hostname f20-vm.example.com --install "@core" --firstboot-command 'yum update -y' --firstboot-command 'localectl set-locale LANG=ja_JP.utf8' --firstboot-command 'set-keymap jp'
virt-builder: warning: cache /root/.cache/virt-builder: Unix.Unix_error(20, "mkdir", "/root/.cache/virt-builder")
virt-builder: disabling the cache
[   1.0] Downloading: http://libguestfs.org/download/builder/fedora-20.xz
#######################################################################  100.0%
[ 510.0] Planning how to build this image
[ 510.0] Uncompressing
[ 521.0] Resizing (using virt-resize) to expand the disk to 20.0G
Fatal error: exception Guestfs.Error("could not create appliance through libvirt.

Try running qemu directly without libvirt using this environment variable:
export LIBGUESTFS_BACKEND=direct

Original error from libvirt: 内部エラー: モニターに接続中にプロセス

Configure LIBGUESTFS_BACKEND environment.
# export LIBGUESTFS_BACKEND=direct

# echo $LIBGUESTFS_BACKEND
direct

okay.
# virt-builder fedora-20 --root-password file:./rootpw.txt -o f20-vm.qcow2 --format qcow2 --size 20G --hostname f20-vm.example.com --install "@core" --firstboot-command 'yum update -y' --firstboot-command 'localectl set-locale LANG=ja_JP.utf8' --firstboot-command 'set-keymap jp'
virt-builder: warning: cache /root/.cache/virt-builder: Unix.Unix_error(20, "mkdir", "/root/.cache/virt-builder")
virt-builder: disabling the cache
[   1.0] Downloading: http://libguestfs.org/download/builder/fedora-20.xz
#######################################################################  100.0%
[ 518.0] Planning how to build this image
[ 518.0] Uncompressing
[ 529.0] Resizing (using virt-resize) to expand the disk to 20.0G
[ 561.0] Opening the new disk
[ 565.0] Setting a random seed
[ 565.0] Setting the hostname: f20-vm.example.com
[ 565.0] Setting root password
[ 565.0] Installing packages: @core
[ 624.0] Installing firstboot command: [1] yum update -y
[ 624.0] Installing firstboot command: [2] localectl set-locale LANG=ja_JP.utf8
[ 624.0] Installing firstboot command: [3] set-keymap jp
[ 624.0] Finishing off
Output: f20-vm.qcow2
Output size: 20.0G
Output format: qcow2
Total usable space: 19.0G
Free space: 18.1G (95%)

the VM image has been created under the directory where you issued virt-builder command.

# file f20-vm.qcow2
f20-vm.qcow2: QEMU QCOW Image (unknown version)

copy the original VM image to KVM pool ( in my case, /var/lib/libvit/images/disk1 )

# cp f20-vm.qcow2 /var/lib/libvirt/images/disk1/f20.qcow2

deploy the VM.
# yum install virt-install


# virt-install --import --name f20-vm1 --ram 512 --disk path=/var/lib/libvirt/images/disk1/f20-vm1.qcow2,format=qcow2,device=disk,bus=virtio,20G
ERROR    Error with storage parameters: Size must be specified for non existent volume path '/var/lib/libvirt/images/disk1/f20-vm1.qcow2'
[root@f20 Virtbuilder_works]# virt-install
ERROR    
[    0.000000] Initializing cgroup subsys cpuset
[    0.000000] Initializing cgroup subsys cpu
[    0.000000] Initializing cgroup subsys cpuacct
[    0.000000] Linux version 3.11.10-301.fc20.x86_64 (mockbuild@bkernel01.phx2.fedoraproject.org) (gcc version 4.8.2 20131017 (Red Hat 4.8.2-1) (GCC) ) #1 SMP Thu Dec 5 14:01:17 UTC 2013
[    0.000000] Command line: BOOT_IMAGE=/vmlinuz-3.11.10-301.fc2


when booting the VM for the  first time, execute “yum update” automatically.
[  112.857596] firstboot.sh[408]: Transaction test succeeded
[  112.859440] firstboot.sh[408]: Running transaction
[  114.431092] firstboot.sh[408]: Updating   : libselinux-2.2.1-6.fc20.x86_64                             1/129
[  115.127248] firstboot.sh[408]: Updating   : nspr-4.10.2-1.fc20.x86_64                                  2/129
[  115.797586] firstboot.sh[408]: Updating   : nss-util-3.15.3-1.fc20.x86_64                              3/129
[  116.429433] firstboot.sh[408]: Updating   : audit-libs-2.3.3-1.fc20.x86_64                             4/129

Fedora 20: gather information about a domain with dnsenum

dnsenum is a tool to collect DNS information, such as, A, NS, whois etc

In case of Fedora20, you can install dnsenum via yum.
# cat /etc/fedora-release ;uname -ri
Fedora release 20 (Heisenbug)
3.12.7-300.fc20.x86_64 x86_64

install
# yum install -y dnsenum.noarch

To check the usage, please type “dnsenum –help”
# dnsenum --help
dnsenum.pl VERSION:1.2
Usage: dnsenum.pl [Options] <domain>
[Options]:
Note: the brute force -f switch must be specified to be able to continue
the process execution.
GENERAL OPTIONS:
 --dnsserver   <server>
                       Use this DNS server for A, NS and MX queries.
 --enum                Shortcut option equivalent to --threads 5 -s 20 -w.
 -h, --help            Print this help message.
 --noreverse           Skip the reverse lookup operations.

Here are sample usages.

needs Net::WhoisIP module to get whois information.
# dnsenum -r -d 3 -w -r --dnsserver 192.168.0.100 isc.org
dnsenum.pl VERSION:1.2
Warning: can't load Net::Whois::IP module, whois queries desabled.

-----   isc.org   -----

-----------------
Host's addresses:
-----------------
isc.org.       49      IN      A       149.20.64.69

-------------
Name servers:
-------------
 ns.isc.afilias-nst.info.      86151   IN      A       199.254.63.254
 sfba.sns-pb.isc.org.  6951    IN      A       149.20.64.3
 ord.sns-pb.isc.org.   6951    IN      A       199.6.0.30
 ams.sns-pb.isc.org.   6951    IN      A       199.6.1.30

-----------
MX record:
-----------
 mx.pao1.isc.org.      3352    IN      A       149.20.64.53
 mx.ams1.isc.org.      3352    IN      A       199.6.1.65

---------------------
Trying Zonetransfers:
---------------------

trying zonetransfer for isc.org on ns.isc.afilias-nst.info ...

trying zonetransfer for isc.org on sfba.sns-pb.isc.org ...

trying zonetransfer for isc.org on ord.sns-pb.isc.org ...

trying zonetransfer for isc.org on ams.sns-pb.isc.org ...

brute force file not specified, bay.

install Net::WhoisIP via yum
# yum install -y perl-Net-Whois-IP

try again.
# dnsenum -r -d 3 -w -r --dnsserver 192.168.0.100 isc.org -v
dnsenum.pl VERSION:1.2

-----   isc.org   -----

-----------------
Host's addresses:
-----------------
isc.org.       21      IN      A       149.20.64.69

-------------
Name servers:
-------------
 sfba.sns-pb.isc.org.  6770    IN      A       149.20.64.3
 ams.sns-pb.isc.org.   6770    IN      A       199.6.1.30
 ns.isc.afilias-nst.info.      85970   IN      A       199.254.63.254
 ord.sns-pb.isc.org.   6770    IN      A       199.6.0.30

-----------
MX record:
-----------
 mx.pao1.isc.org.      3171    IN      A       149.20.64.53
 mx.ams1.isc.org.      3171    IN      A       199.6.1.65

---------------------
Trying Zonetransfers:
---------------------

trying zonetransfer for isc.org on sfba.sns-pb.isc.org ...
 AXFR record query failed: Response code from server: REFUSED

trying zonetransfer for isc.org on ams.sns-pb.isc.org ...
 AXFR record query failed: Response code from server: REFUSED

trying zonetransfer for isc.org on ns.isc.afilias-nst.info ...
 AXFR record query failed: Response code from server: REFUSED

trying zonetransfer for isc.org on ord.sns-pb.isc.org ...
 AXFR record query failed: Response code from server: REFUSED

----------------
Wildcards test:
----------------
good

brute force file not specified, bay.