Wednesday, January 27, 2016

Installing OpenJDK 8 and Tomcat 8 on Debian Jessie

Debian 8 (Jessie) already support JDK 8 and Tomcat 8.

Tomcat 8 exist in jessie repository and jessie-backports repository. For latest Tomcat 8, we use jessie-backports

Do these easy step to install OpenJDK 8 and Tomcat 8 on Debian Jessie:
  1. Edit /etc/apt/sources.list and add these lines (you may ignore line with #)
    # Backport Testing on stable
    # JDK 8
    deb http://ftp.de.debian.org/debian jessie-backports main
  2. # apt-get update
  3. # apt-get install openjdk-8-jdk
  4. # apt-get install tomcat8 tomcat8-admin
If you upgrade your Debian 7 (does not support Tomcat 8) to Debian 8, you may lost some Tomcat 8 files. Here is some script you can used into your tomcat8 installation:
/etc/default/tomcat8
 # Run Tomcat as this user ID. Not setting this or leaving it blank will use the
# default of tomcat8.
TOMCAT8_USER=tomcat8

# Run Tomcat as this group ID. Not setting this or leaving it blank will use
# the default of tomcat8.
TOMCAT8_GROUP=tomcat8

# The home directory of the Java development kit (JDK). You need at least
# JDK version 7. If JAVA_HOME is not set, some common directories for
# OpenJDK and the Oracle JDK are tried.
#JAVA_HOME=/usr/lib/jvm/java-7-openjdk

# You may pass JVM startup parameters to Java here. If unset, the default
# options will be: -Djava.awt.headless=true -Xmx128m -XX:+UseConcMarkSweepGC
#
# Use "-XX:+UseConcMarkSweepGC" to enable the CMS garbage collector (improved
# response time). If you use that option and you run Tomcat on a machine with
# exactly one CPU chip that contains one or two cores, you should also add
# the "-XX:+CMSIncrementalMode" option.
JAVA_OPTS="-Djava.awt.headless=true -Xmx128m -XX:+UseConcMarkSweepGC"

# To enable remote debugging uncomment the following line.
# You will then be able to use a java debugger on port 8000.
#JAVA_OPTS="${JAVA_OPTS} -Xdebug -Xrunjdwp:transport=dt_socket,address=8000,serv
er=y,suspend=n"

# Java compiler to use for translating JavaServer Pages (JSPs). You can use all
# compilers that are accepted by Ant's build.compiler property.
#JSP_COMPILER=javac

# Use the Java security manager? (yes/no, default: no)
#TOMCAT8_SECURITY=no

# Number of days to keep logfiles in /var/log/tomcat8. Default is 14 days.
#LOGFILE_DAYS=14
# Whether to compress logfiles older than today's
#LOGFILE_COMPRESS=1

# Location of the JVM temporary directory
# WARNING: This directory will be destroyed and recreated at every startup !
#JVM_TMP=/tmp/tomcat8-temp

# If you run Tomcat on port numbers that are all higher than 1023, then you
# do not need authbind.  It is used for binding Tomcat to lower port numbers.
# (yes/no, default: no)
#AUTHBIND=no
/etc/init.d/tomcat8 with chmod 755
#!/bin/sh
#
# /etc/init.d/tomcat8 -- startup script for the Tomcat 8 servlet engine
#
# Written by Miquel van Smoorenburg <miquels@cistron.nl>.
# Modified for Debian GNU/Linux    by Ian Murdock <imurdock@gnu.ai.mit.edu>.
# Modified for Tomcat by Stefan Gybas <sgybas@debian.org>.
# Modified for Tomcat6 by Thierry Carrez <thierry.carrez@ubuntu.com>.
# Modified for Tomcat7 by Ernesto Hernandez-Novich <emhn@itverx.com.ve>.
# Additional improvements by Jason Brittain <jason.brittain@mulesoft.com>.
#
### BEGIN INIT INFO
# Provides:          tomcat8
# Required-Start:    $local_fs $remote_fs $network
# Required-Stop:     $local_fs $remote_fs $network
# Should-Start:      $named
# Should-Stop:       $named
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Start Tomcat.
# Description:       Start the Tomcat servlet engine.
### END INIT INFO

set -e

PATH=/bin:/usr/bin:/sbin:/usr/sbin
NAME=tomcat8
DESC="Tomcat servlet engine"
DEFAULT=/etc/default/$NAME
JVM_TMP=/tmp/tomcat8-$NAME-tmp

if [ `id -u` -ne 0 ]; then
    echo "You need root privileges to run this script"
    exit 1
fi

# Make sure tomcat is started with system locale
if [ -r /etc/default/locale ]; then
    . /etc/default/locale
    export LANG
fi

. /lib/lsb/init-functions

if [ -r /etc/default/rcS ]; then
    . /etc/default/rcS
fi


# The following variables can be overwritten in $DEFAULT

# Run Tomcat 8 as this user ID and group ID
TOMCAT8_USER=tomcat8
TOMCAT8_GROUP=tomcat8

# this is a work-around until there is a suitable runtime replacement
# for dpkg-architecture for arch:all packages
# this function sets the variable JDK_DIRS
find_jdks()
{
    for java_version in 9 8 7
    do
        for jvmdir in /usr/lib/jvm/java-${java_version}-openjdk-* \
                      /usr/lib/jvm/jdk-${java_version}-oracle-* \
                      /usr/lib/jvm/jre-${java_version}-oracle-*
        do
            if [ -d "${jvmdir}" ]
            then
                JDK_DIRS="${JDK_DIRS} ${jvmdir}"
            fi
        done
    done

    # Add older non multi arch installations
    JDK_DIRS="${JDK_DIRS} /usr/lib/jvm/java-7-oracle"
}

# The first existing directory is used for JAVA_HOME (if JAVA_HOME is not
# defined in $DEFAULT)
JDK_DIRS="/usr/lib/jvm/default-java"
find_jdks

# Look for the right JVM to use
for jdir in $JDK_DIRS; do
    if [ -r "$jdir/bin/java" -a -z "${JAVA_HOME}" ]; then
    JAVA_HOME="$jdir"
    fi
done
export JAVA_HOME

# Directory where the Tomcat 8 binary distribution resides
CATALINA_HOME=/usr/share/$NAME

# Directory for per-instance configuration files and webapps
CATALINA_BASE=/var/lib/$NAME

# Use the Java security manager? (yes/no)
TOMCAT8_SECURITY=no

# Default Java options
# Set java.awt.headless=true if JAVA_OPTS is not set so the
# Xalan XSL transformer can work without X11 display on JDK 1.4+
# It also looks like the default heap size of 64M is not enough for most cases
# so the maximum heap size is set to 128M
if [ -z "$JAVA_OPTS" ]; then
    JAVA_OPTS="-Djava.awt.headless=true -Xmx128M"
fi

# End of variables that can be overwritten in $DEFAULT

# overwrite settings from default file
if [ -f "$DEFAULT" ]; then
    . "$DEFAULT"
fi

if [ ! -f "$CATALINA_HOME/bin/bootstrap.jar" ]; then
    log_failure_msg "$NAME is not installed"
    exit 1
fi

POLICY_CACHE="$CATALINA_BASE/work/catalina.policy"

if [ -z "$CATALINA_TMPDIR" ]; then
    CATALINA_TMPDIR="$JVM_TMP"
fi

# Set the JSP compiler if set in the tomcat8.default file
if [ -n "$JSP_COMPILER" ]; then
    JAVA_OPTS="$JAVA_OPTS -Dbuild.compiler=\"$JSP_COMPILER\""
fi

SECURITY=""
if [ "$TOMCAT8_SECURITY" = "yes" ]; then
    SECURITY="-security"
fi

# Define other required variables
CATALINA_PID="/var/run/$NAME.pid"
CATALINA_SH="$CATALINA_HOME/bin/catalina.sh"

# Look for Java Secure Sockets Extension (JSSE) JARs
if [ -z "${JSSE_HOME}" -a -r "${JAVA_HOME}/jre/lib/jsse.jar" ]; then
    JSSE_HOME="${JAVA_HOME}/jre/"
fi

catalina_sh() {
    # Escape any double quotes in the value of JAVA_OPTS
    JAVA_OPTS="$(echo $JAVA_OPTS | sed 's/\"/\\\"/g')"

    AUTHBIND_COMMAND=""
    if [ "$AUTHBIND" = "yes" -a "$1" = "start" ]; then
        AUTHBIND_COMMAND="/usr/bin/authbind --deep /bin/bash -c "
    fi

    # Define the command to run Tomcat's catalina.sh as a daemon
    # set -a tells sh to export assigned variables to spawned shells.
    TOMCAT_SH="set -a; JAVA_HOME=\"$JAVA_HOME\"; source \"$DEFAULT\"; \
        CATALINA_HOME=\"$CATALINA_HOME\"; \
        CATALINA_BASE=\"$CATALINA_BASE\"; \
        JAVA_OPTS=\"$JAVA_OPTS\"; \
        CATALINA_PID=\"$CATALINA_PID\"; \
        CATALINA_TMPDIR=\"$CATALINA_TMPDIR\"; \
        LANG=\"$LANG\"; JSSE_HOME=\"$JSSE_HOME\"; \
        cd \"$CATALINA_BASE\"; \
        \"$CATALINA_SH\" $@"

    if [ "$AUTHBIND" = "yes" -a "$1" = "start" ]; then
        TOMCAT_SH="'$TOMCAT_SH'"
    fi

    # Run the catalina.sh script as a daemon
    set +e
    touch "$CATALINA_PID" "$CATALINA_BASE"/logs/catalina.out
    chown $TOMCAT8_USER "$CATALINA_PID" "$CATALINA_BASE"/logs/catalina.out
    start-stop-daemon --start -b -u "$TOMCAT8_USER" -g "$TOMCAT8_GROUP" \
        -c "$TOMCAT8_USER" -d "$CATALINA_TMPDIR" -p "$CATALINA_PID" \
        -x /bin/bash -- -c "$AUTHBIND_COMMAND $TOMCAT_SH"
    status="$?"
    set +a -e
    return $status
}

case "$1" in
  start)
    if [ -z "$JAVA_HOME" ]; then
        log_failure_msg "no JDK or JRE found - please set JAVA_HOME"
        exit 1
    fi

    if [ ! -d "$CATALINA_BASE/conf" ]; then
        log_failure_msg "invalid CATALINA_BASE: $CATALINA_BASE"
        exit 1
    fi

    log_daemon_msg "Starting $DESC" "$NAME"
    if start-stop-daemon --test --start --pidfile "$CATALINA_PID" \
        --user $TOMCAT8_USER --exec "$JAVA_HOME/bin/java" \
        >/dev/null; then

        # Regenerate POLICY_CACHE file
        umask 022
        echo "// AUTO-GENERATED FILE from /etc/tomcat8/policy.d/" \
            > "$POLICY_CACHE"
        echo ""  >> "$POLICY_CACHE"
        cat $CATALINA_BASE/conf/policy.d/*.policy \
            >> "$POLICY_CACHE"

        # Remove / recreate JVM_TMP directory
        rm -rf "$JVM_TMP"
        mkdir -p "$JVM_TMP" || {
            log_failure_msg "could not create JVM temporary director
y"
            exit 1
        }
        chown $TOMCAT8_USER "$JVM_TMP"

        catalina_sh start $SECURITY
        sleep 5
            if start-stop-daemon --test --start --pidfile "$CATALINA_PID" \
            --user $TOMCAT8_USER --exec "$JAVA_HOME/bin/java" \
            >/dev/null; then
            if [ -f "$CATALINA_PID" ]; then
                rm -f "$CATALINA_PID"
            fi
            log_end_msg 1
        else
            log_end_msg 0
        fi
    else
            log_progress_msg "(already running)"
        log_end_msg 0
    fi
    ;;
  stop)
    log_daemon_msg "Stopping $DESC" "$NAME"

    set +e
    if [ -f "$CATALINA_PID" ]; then
        start-stop-daemon --stop --pidfile "$CATALINA_PID" \
            --user "$TOMCAT8_USER" \
            --retry=TERM/20/KILL/5 >/dev/null
        if [ $? -eq 1 ]; then
            log_progress_msg "$DESC is not running but pid file exis
ts, cleaning up"
        elif [ $? -eq 3 ]; then
            PID="`cat $CATALINA_PID`"
            log_failure_msg "Failed to stop $NAME (pid $PID)"
            exit 1
        fi
        rm -f "$CATALINA_PID"
        rm -rf "$JVM_TMP"
    else
        log_progress_msg "(not running)"
    fi
    log_end_msg 0
    set -e
    ;;
   status)
    set +e
    start-stop-daemon --test --start --pidfile "$CATALINA_PID" \
        --user $TOMCAT8_USER --exec "$JAVA_HOME/bin/java" \
        >/dev/null 2>&1
    if [ "$?" = "0" ]; then

        if [ -f "$CATALINA_PID" ]; then
            log_success_msg "$DESC is not running, but pid file exists."
            exit 1
        else
            log_success_msg "$DESC is not running."
            exit 3
        fi
    else
        log_success_msg "$DESC is running with pid `cat $CATALINA_PID`"
    fi
    set -e
        ;;
  restart|force-reload)
    if [ -f "$CATALINA_PID" ]; then
        $0 stop
        sleep 1
    fi
    $0 start
    ;;
  try-restart)
        if start-stop-daemon --test --start --pidfile "$CATALINA_PID" \
        --user $TOMCAT8_USER --exec "$JAVA_HOME/bin/java" \
        >/dev/null; then
        $0 start
    fi
        ;;
  *)
    log_success_msg "Usage: $0 {start|stop|restart|try-restart|force-reload|
status}"
    exit 1
    ;;
esac

exit 0
You can check folder /etc/tomcat8 and compare them with its default https://packages.debian.org/jessie-backports/all/tomcat8/filelist

Monday, January 18, 2016

Centos 6 bridge network

Directory /etc/sysconfig/network-scripts/

Note:
Instead of turning off NetworkManager , add "NM_CONTROLLED=no " to the ifcfg-* .

Edit or create /etc/sysconfig/network-scripts/ifcfg-eth0:
DEVICE=eth0
TYPE=Ethernet
BOOTPROTO=none
# change the hardware address to match the hardware address your NIC uses
HWADDR=00:16:76:D6:C9:45
ONBOOT=yes
BRIDGE=br0
NM_CONTROLLED=no

Edit or create /etc/sysconfig/network-scripts/ifcfg-br0 dhcp:
DEVICE=br0
TYPE=Bridge
BOOTPROTO=dhcp
ONBOOT=yes
NM_CONTROLLED=no
DELAY=0

Edit or create /etc/sysconfig/network-scripts/ifcfg-br0 static
DEVICE=br0
TYPE=Bridge
IPADDR=192.168.1.1
NETMASK=255.255.255.0
ONBOOT=yes
BOOTPROTO=none
NM_CONTROLLED=no
DELAY=0

# service network restart

Iptables
# iptables -I FORWARD -m physdev --physdev-is-bridged -j ACCEPT
# service iptables save
# service iptables restart

Edit and append /etc/sysctl.conf:
net.bridge.bridge-nf-call-ip6tables = 0
net.bridge.bridge-nf-call-iptables = 0
net.bridge.bridge-nf-call-arptables = 0

Reload kernel parameter and libvirt service
# sysctl -p /etc/sysctl.conf
# service libvirtd reload

# brctl show

-----------------------------
2 nic bond
-----------------------------
Edit or create /etc/sysconfig/network-scripts/ifcfg-eth0:
DEVICE=eth0
TYPE=Ethernet
BOOTPROTO=none
# change the hardware address to match the hardware address your NIC uses
HWADDR=00:16:76:D6:C9:45
ONBOOT=yes
BRIDGE=br0
NM_CONTROLLED=no
USERCTL=no
SLAVE=yes
MASTER=bond0

Edit or create /etc/sysconfig/network-scripts/ifcfg-eth1:
DEVICE=eth1
TYPE=Ethernet
BOOTPROTO=none
# change the hardware address to match the hardware address your NIC uses
HWADDR=00:16:76:D6:C9:45
ONBOOT=yes
BRIDGE=br0
NM_CONTROLLED=no
USERCTL=no
SLAVE=yes
MASTER=bond0

Edit or create /etc/sysconfig/network-scripts/ifcfg-bond0:
DEVICE=bond0
ONBOOT=yes
BONDING_OPTS='mode=1 miimon=100'
BRIDGE=br0
NM_CONTROLLED=no
BOOTPROTO=none

Edit or create /etc/sysconfig/network-scripts/ifcfg-br0:
DEVICE=br0
ONBOOT=yes
TYPE=Bridge
IPADDR=192.168.1.1
NETMASK=255.255.255.0
NM_CONTROLLED=no

Available bond mode:
balance-rr or 0
active-backup or 1
balance-xor or 2
broadcast or 3
802.3ad or 4
balance-tlb or 5
balance-alb or 6

https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Deployment_Guide/s2-networkscripts-interfaces_network-bridge.html
http://www.linux-kvm.org/page/HOWTO_BONDING#Problem_with_Bridge_.2B_Bonding

Friday, January 15, 2016

Removing Build-in Application in Windows 10

Use PowerShell to Uninstall Built-in Apps

Uninstall 3D Builder:
Get-AppxPackage *3dbuilder* | Remove-AppxPackage
Uninstall Alarms and Clock:
Get-AppxPackage *windowsalarms* | Remove-AppxPackage
Uninstall Calculator:
Get-AppxPackage *windowscalculator* | Remove-AppxPackage
Uninstall Calendar and Mail:
Get-AppxPackage *windowscommunicationsapps* | Remove-AppxPackage
Uninstall Camera:
Get-AppxPackage *windowscamera* | Remove-AppxPackage
Uninstall Contact Support:
This app can’t be removed.
Uninstall Cortana:
This app can’t be removed.
Uninstall Get Office:
Get-AppxPackage *officehub* | Remove-AppxPackage
Uninstall Get Skype:
Get-AppxPackage *skypeapp* | Remove-AppxPackage
Uninstall Get Started:
Get-AppxPackage *getstarted* | Remove-AppxPackage
Uninstall Groove Music:
Get-AppxPackage *zunemusic* | Remove-AppxPackage
Uninstall Maps:
Get-AppxPackage *windowsmaps* | Remove-AppxPackage
Uninstall Microsoft Edge:
This app can’t be removed.
Uninstall Microsoft Solitaire Collection:
Get-AppxPackage *solitairecollection* | Remove-AppxPackage
Uninstall Money:
Get-AppxPackage *bingfinance* | Remove-AppxPackage
Uninstall Movies & TV:
Get-AppxPackage *zunevideo* | Remove-AppxPackage
Uninstall News:
Get-AppxPackage *bingnews* | Remove-AppxPackage
Uninstall OneNote:
Get-AppxPackage *onenote* | Remove-AppxPackage
Uninstall People:
Get-AppxPackage *people* | Remove-AppxPackage
Uninstall Phone Companion:
Get-AppxPackage *windowsphone* | Remove-AppxPackage
Uninstall Photos:
Get-AppxPackage *photos* | Remove-AppxPackage
Uninstall Store:
Get-AppxPackage *windowsstore* | Remove-AppxPackage
Uninstall Sports:
Get-AppxPackage *bingsports* | Remove-AppxPackage
Uninstall Voice Recorder:
Get-AppxPackage *soundrecorder* | Remove-AppxPackage
Uninstall Weather:
Get-AppxPackage *bingweather* | Remove-AppxPackage
Uninstall Windows Feedback:
This app can’t be removed.
Uninstall Xbox:
Get-AppxPackage *xboxapp* | Remove-AppxPackage

How to Reinstall All Built-in Apps

If you decide you want the preinstalled apps back, you can get them back with a single line of PowerShell code. Again, open a PowerShell window as Administrator. Copy and paste the following line into the PowerShell window and press Enter:
Get-AppxPackage -AllUsers| Foreach {Add-AppxPackage -DisableDevelopmentMode -Register “$($_.InstallLocation)\AppXManifest.xml”}
This tells Windows to install those default apps again. Give it some time and allow it to finish, even if nothing appears to happen at first. Even if you see an error message, restart and examine your Start menu — you may just have all those default apps back again, anyway.

Source: http://www.howtogeek.com/224798/how-to-uninstall-windows-10s-built-in-apps-and-how-to-reinstall-them/

Debian Jessie KVM

Installasi:
# apt-get install qemu-kvm libvirt-bin virtinst bridge-utils
Grand user to manage:
# adduser dedetok kvm
# adduser dedetok libvirt
---------------------------------------------------
List all virtual
# virsh list --all
---------------------------------------------------
Default KVM with NAT
---------------------------------------------------
NAT Configuring default network
# virsh net-info default
# virsh net-autostart default
# virsh net-start default
---------------------------------------------------
KVM with bridge network
---------------------------------------------------
Setting up network using bridge
# brctl addbr br0
# ip addr show
# brctl addif br0 eth0
---------------------------------------------------
or write configuration permanently:
---------------------------------------------------
edit /etc/network/interfaces
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
#auto eth0
#iface eth0 inet static
# address 192.168.1.10
# netmask 255.255.255.0
# gateway 192.168.1.1
iface eth0 inet manual
# Initial bridge for static
auto br0
iface br0 inet static
bridge_ports eth0
address 192.168.1.10
broadcast 192.168.1.255
netmask 255.255.255.0
gateway 192.168.1.1
bridge_stp off
bridge_fd 0
bridge-waitport 0
dns-nameservers 8.8.8.8
# Initial bridge for dhcp
#auto br0
#iface br0 inet dhcp
# bridge_ports eth0
iface br0 inet6 static
address 2001:db8::1
netmask 64
gateway fe80::1
autoconf 0
#iface br0 inet6 auto
---------------------------------------------------
additional interface option:
  • bridge_stp off # disable Spanning Tree Protocol
  • bridge_waitport 0 # no delay before a port becomes available
  • bridge_fd 0 # no forwarding delay
  • bridge_ports none # if you do not want to bind to any ports
  • bridge_ports regex eth* # use a regular expression to define ports
---------------------------------------------------
edit /etc/resolv.conf
nameserver 192.168.1.1
---------------------------------------------------
edit /etc/sysctl.conf
net.ipv4.ip_forward = 1
net.ipv6.conf.all.forwarding=1
---------------------------------------------------
For performance and security reasons, disable netfilter for bridges. Edit /etc/sysctl.conf or create /etc/sysctl.d/bridge.conf with these contents:
net.bridge.bridge-nf-call-ip6tables=0
net.bridge.bridge-nf-call-iptables=0
net.bridge.bridge-nf-call-arptables=0
run
# sysctl -p
If you create /etc/sysctl.d/bridge.conf, then you need to create /etc/udev/rules.d/99-bridge.rules (If using Linux kernel 3.18 or later,
change KERNEL=="bridge" to KERNEL=="br_netfilter")
ACTION=="add", SUBSYSTEM=="module", KERNEL=="bridge", RUN+="/sbin/sysctl -p /etc/sysctl.d/bridge.conf"
To allow all traffic to be forwarded across the bridge from KMV guest:
 -I Insert
# /sbin/iptables -I FORWARD -m physdev --physdev-is-bridged -j ACCEPT
-P Policy
# iptables -P INPUT ACCEPT
Add default gateway (not necessary)
# route add default gw 192.168.1.1
---------------------------------------------------
network bonding and bridging
---------------------------------------------------
assuming server has 2 network interface eth0 and eth1.
# apt-get install bridge-utils ifenslave
edit /etc/network/interfaces:
# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
iface eth0 inet manual
iface eth1 inet manual
# Initial bridge for static
auto br0
iface br0 inet static
bridge_ports bond0
address 192.168.1.10
broadcast 192.168.1.255
netmask 255.255.255.0
gateway 192.168.1.1
bridge_stp off
bridge_fd 0
bridge-waitport 0
dns-nameservers 8.8.8.8
iface br0 inet6 auto
auto bond0
iface bond0 inet manual
slaves eth0 eth1
bond-mode 802.3ad
# bond_mode active-backup
bond-miimon 100
bond-downdelay 200
bond-updelay 200
Available bond mode:
  • balance-rr or 0
  • active-backup or 1
  • balance-xor or 2
  • broadcast or 3
  • 802.3ad or 4
  • balance-tlb or 5
  • balance-alb or 6
---------------------------------------------------
copy iso file into folder /var/lib/libvirt/boot/ (eq dsl-4.4.10.iso)
Create virtual machine: ram 256 with Storage 5G using NAT
# virt-install --name dsl01 --ram 256 --cdrom /var/lib/libvirt/boot/dsl-4.4.10.iso --disk path=/var/lib/libvirt/images/dl01.img,size=5 --network bridge=br0 --graphics none
Create virtual machine: ram 256 with Storage 5G using bridge
# virt-install --name dsl01 --ram 256 --cdrom /var/lib/libvirt/boot/dsl-4.4.10.iso --disk path=/var/lib/libvirt/images/dl01.img,size=5 --network bridge=br0 --graphics none
Create virtual machine ram 2G, virtual cpu 4 with disk image bridge virbr0 (NAT) using Debian network installer no graphics (using console)
# virt-install --virt-type kvm --name deb01 --location http://httpredir.debian.org/debian/dists/jessie/main/installer-amd64/ --extra-args "console=ttyS0" -v --disk path=/home/kvmimages/deb01/disk1.img --memory 2048 --vcpu 4 --network bridge:virbr0
Reference: