Sunday, 6 December 2020

Installing TightVNC server in RHEL 7

 Installing TightVNC server for root user and enabling same, every step is performed as root only.


Install VNC with the following command

yum install tigervnc-server

Set password for VNC (no need to enable viewing only) with the following command

vncpasswd

Copy VNC service configuration file to systemd with the following command

cp /lib/systemd/system/vncserver@.service  /etc/systemd/system/vncserver@:1.service

Edit VNC service configuration file with following command

vi /etc/systemd/system/vncserver@\:1.service

Add the following lines after Type=simple. and hashout earlier similar lines present there.

ExecStartPre=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :'

ExecStart=/sbin/runuser -l root -c "/usr/bin/vncserver %i -geometry 1280x1024"

PIDFile=/home/root/.vnc/%H%i.pid

ExecStop=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :'

Save file.

Reload systemd enter following commands one by one. (if you are getting any issues in the second command mostly you did a mistake in config file.)

systemctl daemon-reload

systemctl start vncserver@:1

systemctl status vncserver@:1

systemctl enable vncserver@:1

Add exception in firewall with following commands (if any) for allowing VNC.

firewall-cmd --add-port=5901/tcp

firewall-cmd --add-port=5901/tcp --permanent

Wednesday, 22 May 2019

WSUS on Windows 2016 core without using powershell, only GUI.



This is how i did WSUS server installation and configuration in Windows 2016 standard server core without using powershell. 

Personally i don't hate powershell, but decided to make life little bit easier.

As the manual contains a lot of sections i am not adding screen shots.

Our scenario.
we have a HyperV VM for WSUS server and Windows 10 client installed with Windows admin center (1904), RSAT tools including hyperv manager.

Following is the VM in my case. Quad Core, 12 GB, Bridged NIC, HDD-1 150 GB (for Operating system), HDD-2 1500 GB for WSUS content

let's start!

1. Install Windows 2016 core in HDD-1.

2. Post install of windows 2016 standard core.

  1. Open sconfig in command line and complete following four steps.
  2. Configure hostname, IP address, enable Remote management
  3. Update operating system completely.
  4. Join server in domain.
  5. Add local admin for remote management

3. Configure storage for WSUS content.

  1. Open Windows admin center and format disk and create volume
  2. Create a folder named wsus in new volume

4. Install WSUS

  1. Open server manager, click manage and click add Roles and Features.
  2. It will open a wizard, follow steps in add roles and features wizard. 
  3. Before You Begin, click next
  4. Installation Type, select Role-based or feature-based installation and click next
  5. Server Selection, select server we are planning to install WSUS role.
  6. Server Roles, Select Windows Server Update Services in new window make sure to tick Include management tools and click on Add Features.
  7. Features, click next.
  8. WSUS, click next.
  9. Role Services, Make sure that WID Connectivity and WSUS Services options are ticked and click Next. (WID is windows internal database which is used for Small to medium sized installations) 
  10. Content, click the Store update option in the following location option, and then type the location. in my case (d:\wsus)
  11. Web Server Role (IIS), click Next.
  12. Role Services, click Next.  
  13. Confirmation, have a look at the features to be installed and click Install. (no need to tick Restart the destination server automatically)
  14. Results, click close once installation is succeeded.


Next one is the tricky part, i did Launch post-installation tasks and nothing showed up.
Then i restarted the server and Post-installation part was showing in red, then i clicked on it and it turned to normal color.
Dont worry we can do it from Windows 10 PC and following are the steps.

5. Initial configuration WSUS.

  1. open wsus console from windows 10 pc in which rsat tools are installed.
  2. it will open-up the initial configuration or post deployment tasks of WSUS
  3. Select the location to store updates (d:\wsus in my case)
  4. in the wizard select settings as per your need.
  5. Before You Begin, click Next.
  6. Microsoft Update Improvement Program, untick click Next
  7. Choose Upstream Server, select which server will synchronize the WSUS server. If it is first WSUS server then select Synchronize from Microsoft Update.
  8. Specify Proxy Server, click Next. (fill the fields if there is proxy)
  9. Click on the Start Connecting and wait until the process completes, this is fetching details from upstream server which may take several minutes.
  10. Choose Languages, select the language which using in your infrastructure. dont select unwanted languages else it will download unwanted updates and eat up the resources. 
  11. Choose Product, Go through the list of products and select only the products which you are using. else it will download unwanted updates and eat up the resources.
  12. Choose Classifications,  select only the update categories you are planning to use, i selected Critical, Definition, Security & Upgrades. don't select drives and other stuff.
  13. Configure Sync Schedule, select non business hours for this job.
  14. Finished, Tick Begin initial synchronization and click next then finish.
  15. This concludes basic installation of WSUS server in windows 2016 core


6. Automatic approvals for selected category of updates.

  1. Open WSUS console in Windows 10 PC, to to options -> Automatic Approvals
  2. in Update rules select the type of updates you automatically want to install in clients.
  3. Tick Default Automatic Approvals Rule and click apply.
  4. Click Run Rule to apply rules on downloaded updates. (if synchronisation is over)
  5. Click ok to close the window.


7. Configure the GPO for setting how clients are going to receive updates.

  1. Open Group Policy Management Console on the Domain Controller and select the GPO which you want configure Automatic Updates right click edit. 
  2. In the Group policy management editor expand computer Configuration -> Policies -> Administrative Templates -> Windows components -> Windows Update. 
  3. In the right pane, Open Configure Automatic Updates and click Enable. And select the appropriate options as per requirement.
  4. Next open Specify intranet Microsoft update service location and specify the server address like follows. http://servername:8530


8. Configure IIS on WSUS server for remote management.

  1. install iis management tools in windows 10 PC for remote administration of iis in WSUS server. 
  2. Control panel -> Programs and Features -> Turn Windows Features on or off -> Expand Internet Information services -> Select Web management tools -> click OK
  3. Download and install IIS Manager for Remote Administration from Microsoft site.
  4. Enable remote administration of IIS in WSUS server
  5. Open windows admin center go to roles & features, in webserver(IIS) section install management service
  6. change the registry values as following
  7. HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\WebManagement\Server and change the value of the EnableRemoteManagement from 0 to 1.
  8. Start WMSVC service (keep it manual as we need it only when its required)
  9. Open iis manager in windows 10 PC 
  10. Right click on start page (left side top corner under connections)
  11. Click on connect to a server
  12. Enter the server name then credentials. (with admin privileges)
9. Reports viewer installation, this should be installed on the PC using for remote administration.
     1. Install Microsoft system CLR Types for SQL Server 2012 (x64).
     2. Install Microsoft report viewr 2012 runtime.



If node reset issue facing in WSUS console then (following steps solved my issue) there are a lot of tweaking steps available on net


  1. Click on WSUS server> Application Pools > Right Click on “WsusPool” and select Advanced Settings.
  2. Make the following settings changes:
  3. Queue Length: 25000
  4. “Service Unavailable” Response: TcpLevel
  5. Failure Interval (minutes): 30
  6. Maximum Failures: 60
  7. Virtual Memory Limit (kb): 0 (for unlimited)

Thursday, 14 July 2016

Install KVM in CentOS-7 Minimal


Installing KVM in CentOS-7 Minimal.


1. Verify that Virtualization Technology (VT) is enabled in your server’s BIOS. Else enable the same in BIOS.

# grep -E 'svm|vmx' /proc/cpuinfo -> you can see some vmx flags

2. Install Required packages for KVM.

# yum install kvm virt-manager libvirt virt-install qemu-kvm xauth dejavu-lgc-sans-fonts libvirt-python libguestfs-tools

3. Enable and start the libvirtd service.

# systemctl enable libvirtd && systemctl start libvirtd

4. Verify the following kernel modules are loaded, and if not load manually.

# cat /proc/modules | grep kvm                -> you will get two lines stating kvm and kvm_Intel  

5. Configure a bridge port for VMs.

5.1 Add following entry in network controller configuration file. (/etc/sysconfig/network-scripts/ifcfg-eno1)

BRIDGE=br0

5.2 Here I am using static IP address for server, and I am going to use the same for bridge interface too.

For this purpose I disabled following lines in network controller configuration file. (/etc/sysconfig/network-scripts/ifcfg-eno1)

#IPADDR="192.168.0.46"
#PREFIX="16"
#GATEWAY="192.168.0.1"
#DNS1="192.168.0.31"
#DNS2="8.8.8.8"

5.3 Create /etc/sysconfig/network-scripts/ifcfg-br0 and add following lines.

DEVICE="br0"
TYPE="Bridge"
ONBOOT="yes"
BOOTPROTO="static"
DELAY="0"
IPADDR="192.168.0.46"
PREFIX="16"
GATEWAY="192.168.0.1"
DNS1="192.168.0.31"
DNS2="8.8.8.8"

5.4 Add following entry in /etc/sysctl.conf to enable network forwarding.

net.ipv4.ip_forward = 1

5.5 Read the file.

# sysctl -p /etc/sysctl.conf

5.6 Restart the ‘NetworkManager’ service.

# systemctl restart NetworkManager

6. Finally connect to KVM and issue list command, it will return an empty table.

# virsh -c qemu:///system list

7. Enable following line in  /etc/libvirt/qemu.conf  to change the default listen address of vnc connection for VM.

vnc_listen = "0.0.0.0"

8. Restart libvirtd service, in order to apply the above change.

9. Now you can connect to Virtual machine manager and start creating VM change storage location and copy iso images of Operating system. else use virt-install.

10. Inorder to connect VM through VNC check the port in console.

#  virsh vncdisplay <domain name>   if the line returns 0 vnc port number will be 5900.

11. Check the same through netstat (if netstat not installed you can install it with net-tools package).

#  netstat -tln|grep :59

12. In tight vnc put 192.168.0.46:5900 as remote host name.




https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-vnc-remote-access-for-the-gnome-desktop-on-centos-7




Thursday, 12 March 2015

Using vi in sqlplus for editing.

Editing in sqlplus.

Enter following command in sqlplus for using VI as an editor.

define_editor='vi'

If you want to make it permanent add the above line to following file.

$ORACLE_HOME/sqlplus/admin/glogin.sql

Friday, 20 June 2014

Install TFTP Server in Ubuntu 14.04


1. Install the package.

$ sudo apt-get install tftpd-hpa

2. Edit config file as follows.

$ sudo vi /etc/default/tftpd-hpa

# /etc/default/tftpd-hpa
TFTP_USERNAME="tftp"
TFTP_DIRECTORY="/tftpboot"
TFTP_ADDRESS="0.0.0.0:69"
TFTP_OPTIONS="-s -c -l"

Note: -l for listening all time this avoided the timeout issue, -c to create files in tftfp folder.

3. Create TFTP folder.

sudo mkdir /tftpboot
$ sudo chmod -R 777 /tftpboot
$ sudo chown -R nobody /tftpboot

4. Finally restart the app to apply new configuration. 

sudo service tftpd-hpa restart

Monday, 14 April 2014

See whats there in root partition





When we check root partition for whats eating up the space, we will get all other partitions details,

 to avoid this..

du -sh --exclude=tmp --exclude=var --exclude=usr --exclude=home --exclude=boot --exclude=proc *

this will exclude the tmp, var, usr, home, boot, proc from root partition...  

Wednesday, 29 May 2013

Delete files older than certain days in linux

Here following command will delete files older than 31 days in current folder.

find -ctime +31 -delete

Thursday, 25 April 2013

Tuesday, 19 March 2013

Installing Oracle 11r2 in RHEL / CentOS (simple installation procedure with OL yum repository for learning purpose)


1. Install RHEL or CentOS . (on completion of installation dont forget to disable Firewall & SE linux)

2. Complete the prerequisites for 11G installation with Public OL yum repository as per following link.
http://www.oracle.com/technetwork/articles/servers-storage-admin/ginnydbinstallonlinux-488779.html

3. Edit /etc/hosts and add a fully qualified name for server like follows.


<IP-address>  <fully-qualified-machine-name>  <machine-name>
192.168.1.10 oratest.mydomain.com oratest


4. Set environment variable for bash shell like follows.

ORACLE_BASE=/oratest/app/oracle; export ORACLE_BASE
ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1; export ORACLE_HOME
ORACLE_SID=DBtest; export ORACLE_SID

PATH=/usr/sbin:$PATH; export PATH
PATH=$ORACLE_HOME/bin:$PATH; export PATH

LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib; export LD_LIBRARY_PATH
CLASSPATH=$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib; export CLASSPATH

5. Set the DISPLAY environment. DISPLAY=<machine-name>:0.0; export DISPLAY

6. Download RDBMS software from following link

http://www.oracle.com/technetwork/database/enterprise-edition/downloads/index.html

7. Once download complete unzip the files by unzip<filename>.zip

8. Goto OraDB11g/database (Extracted folder)

9. Make Directory for oracle software installation and give permission for same.
mkdir -p /disk1/DB
cd /disk1
chown -R oracle:oinstall /DB

10. Run the installer ./runInstaller

This will start the installation.