Wednesday, December 23, 2015

Package manager for WINDOWS systems CHOCO CHOCOLETY

Install CHOCO  (open cmd with Admin rights [click cmd with ctrl+shift pressed]
paste the following
@powershell -NoProfile -ExecutionPolicy Bypass -Command "iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))" && SET PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin


Awesome Apps automatically installed
choco install jivkok.tools -y

Install COBBLER on UBUNTU 14.04.3 LTS

Setup repository (/etc/apt/sources.list) - add following line
OR 

use following command

Install Packages
apt-get -y install apache2 cobbler createrepo deb-mirror dnsmasq fence-agents  libapache2-mod-proxy-html libapache2-mod-wsgi  make   python3-software-properties python-django python-lzma python-software-properties python-tk python-urlgrabber software-properties-common sshfs syrep syslinux testrepository tftp vim  yum yum-utils  

TURNOFF firewall
ufw disable


TURNOFF SELINUX



Enable Module
a2enmod xml2enc


Enable Configuration 
a2enconf cobbler cobbler_web

IMPORT loaders
cobbler get-loaders; 
service cobblerd restart;
cobbler sync;

Restart Cobblerd and sync
service cobblerd restart;
cobbler sync;

Check cobbler config
cobbler check;

set 'server:' 'next_server:' varriable with current IP address of the server in /etc/cobbler/settings
IP_ETH0=$(ifconfig eth0 | grep 'inet addr:' | cut -d":" -f2 | cut -d" " -f1)
sudo sed -i "s/127\.0\.0\.1/${IP_ETH0}/" /etc/cobbler/settings


set the SECRET_KEY for django cobbler_web app
SECRET_KEY=$(python -c 'import re;from random import choice; import sys; sys.stdout.write(re.escape("".join([choice("abcdefghijklmnopqrstuvwxyz0123456789^&*(-_=+)") for i in range(100)])))')
sudo sed --in-place "s/^SECRET_KEY = .*/SECRET_KEY = '${SECRET_KEY}'/" /usr/share/cobbler/web/settings.py

SET THE password for /etc/cobbler/settings
openssl passwd -1 -salt 'random' 'passwrd-here'

set 'manage_dhcp:' 'manage_dns:' 'manage_tftpd' /etc/cobbler/modules.conf
Use the dnsmasq for dns, dhcp and tftpd

Configure the dnsmasq.template (setup DNS, DHCP, TFTP)
vim /etc/cobbler/dnsmasq.template

# Cobbler generated configuration file for dnsmasq
# $date 
#


# Usage logging (use this for debug only !)
log-queries
log-async

## ENable TFTPD
enable-tftp
tftp-root=/var/lib/tftpboot


# resolve.conf .. ?
#no-poll
#enable-dbus
read-ethers
addn-hosts = /var/lib/cobbler/cobbler_hosts

# # Be a proxyDHCP server
dhcp-range=10.31.99.150,proxy

# Only respond to clients that are known (i.e present in /etc/ethers)
dhcp-ignore=#known

# Set this (and domain: see below) if you want to have a domain
# automatically added to simple names in a hosts-file.
expand-hosts
domain=nvidia.com

# Loads <tftp-root>/pxelinux.0 from dnsmasq TFTP server.
pxe-service=x86PC, "Boot PXELinux (=Cobbler controlled)", pxelinux ,$next_server

#dhcp-range=10.31.99.150,10.31.99.254
dhcp-option=3,$next_server
dhcp-lease-max=1000
dhcp-authoritative


dhcp-boot=pxelinux.0
dhcp-boot=net:normalarch,pxelinux.0
dhcp-boot=net:ia64,$elilo

$insert_cobbler_system_definitions




Cobbler IMPORT Fedora 22 distro, repo and reposync
sudo mount -o loop /tmp/Fedora-Server-DVD-x86_64-22.iso /mnt/iso/

sudo cobbler import --path=/mnt/iso --name=fc22 --kickstart=/tmp/eris-ks.cfg
sudo cobbler repo edit --name=fc22-everything-64 --mirror=http://linuxqa/repo/fedora/linux/releases/22/Server/x86_64/os/ --arch=x86_64 --breed=yum
cobbler reposync --only=fc22-everything-64




CHECK ports
netstat -tulpn








Wednesday, December 2, 2015

Local Repo for UBUNTU

Use the following Script to rsync the Ubuntu repository locally for internal use.


#/bin/bash

fatal() {
  echo "$1"
  exit 1
}

warn() {
  echo "$1"
}

# Find a source mirror near you which supports rsync on
# rsync://<iso-country-code>.rsync.archive.ubuntu.com/ubuntu should always work
#RSYNCSOURCE=rsync://mirrors.kernel.org/ubuntu
RSYNCSOURCE=rsync://archive.ubuntu.com/ubuntu
#RSYNCSOURCE=rsync://mirror.pnl.gov/ubuntu/
#RSYNCSOURCE=rsync://ubuntu.osuosl.org/ubuntu/



# Define where you want the mirror-data to be on your mirror
BASEDIR=
#BASEDIR=/var/www/html/repo/ubuntu-08-06-2015/
 #BASEDIR=/var/www/html/repo/ubuntu-04-27-2015/

if [ ! -d ${BASEDIR} ]; then
  warn "${BASEDIR} does not exist yet, trying to create it..."
  mkdir -pv ${BASEDIR} || fatal "Creation of ${BASEDIR} failed."
fi

rsync --progress -v --recursive --times --links --hard-links --stats --exclude "Packages*" --exclude "Sources*" --exclude "Release*" ${RSYNCSOURCE} ${BASEDIR} || fatal "First stage of sync failed."

rsync --progress -v --recursive --times --links --hard-links --stats --delete --delete-after ${RSYNCSOURCE} ${BASEDIR} || fatal "Second stage of sync failed."

date -u > ${BASEDIR}/project/trace/$(hostname -f)
~