Saturday, December 16, 2017

Deleting previous installs of Redhat server ( Redhat subscriptions )

Monday, December 11, 2017

multihop socks proxy over ssh

https://superuser.com/questions/332850/ssh-as-socks-proxy-through-multiple-hosts

Friday, December 1, 2017

multihop ssh with PUTTY

source : https://www.vscentrum.be/client/windows/putty-proxy

 

Setting up a proxy in PuTTY

Setting up the connection in PuTTY is a bit more complicated than for a simple direct connection to a login node.
  1. First you need to start up pageant and load your private key into it. See the instructions on our "Using Pageant" page.
  2. In PuTTY, go first to the "Proxy" category (under "Connection"). In the Proxy tab sheet, you need to fill in the following information:
    1. Select the proxy type: "Local"
    2. Give the name of the "proxy server". This is vsc.login.node, your usual VSC login node, and not the computer on which you want to log on and work.
    3. Make sure that the "Port" number is 22.
    4. Enter your VSC-id in the "Username" field.
    5. In the "Telnet command, or local proxy command", enter the string
      plink -agent -l %user %proxyhost -nc %host:%port
      (the easiest is to just copy-and-paste this text).
      "plink" (PuTTY Link) is a Windows program and comes with the full PuTTY suite of applications. It is the command line version of PuTTY. In case you've only installed the executables putty.exe and pageant.exe, you'll need to download plink.exe also from the PuTTY web site. We strongly advise to simply install the whole PuTTY-suite of applications using the installer provided on that site.
  3. Now go to the "Data" category in PuTTY, again under "Connection".
    1. Fill in your VSC-id in the "Auto-login username" field.
    2. Leave the other values untouched (likely the values in the screen dump)
  4. Now go to the "Session" category
    1. Set the field "Host Name (or IP address) to the computer you want to log on to. If you are setting up a proxy connection to access a computer on the VSC network, you will have to use its name on the internal VSC network. E.g., for the login nodes of the tier-1 cluster Muk at UGent, this is login.muk.gent.vsc and for the cluster on which you can test applications for the Muk, this is gligar.gligar.gent.vsc.
    2. Make sure that the "Port" number is 22.
    3. Finally give the configuration a name in the field "Saved Sessions" and press "Save". Then you won't have to enter all the above information again.
    4. And now you're all set up to go. Press the "Open" button on the "Session" tab to open a terminal window.

Thursday, June 29, 2017

zipimport.ZipImportError: can't decompress data; zlib not available

I got the error

zipimport.ZipImportError: can't decompress data; zlib not available

when I am trying to install Python3.6 from source.


I did the following install

yum install readline-devel  sqlite-devel zlib-devel openssl-devel


and it worked fine then

Friday, May 19, 2017

install Apache tomcat 8 on Centos 7

source : https://www.digitalocean.com/community/tutorials/how-to-install-apache-tomcat-8-on-centos-7


 How To Install Apache Tomcat 8 on CentOS 7

PostedJune 19, 2015 190.7kviews JAVA DEPLOYMENT CENTOS

Introduction

Apache Tomcat is a web server and servlet container that is used to serve Java applications. Tomcat is an open source implementation of the Java Servlet and JavaServer Pages technologies, released by the Apache Software Foundation. This tutorial covers the basic installation and some configuration of the latest release of Tomcat 8 on your CentOS 7 server.

Prerequisites

Before you begin with this guide, you should have a separate, non-root user account set up on your server. You can learn how to do this by completing steps 1-3 in the initial server setup for CentOS 7. We will be using the demo user created here for the rest of this tutorial.

Install Java

Tomcat requires that Java is installed on the server, so any Java web application code can be executed. Let's satisfy that requirement by installing OpenJDK 7 with yum.
To install OpenJDK 7 JDK using yum, run this command:
  • sudo yum install java-1.7.0-openjdk-devel
Answer y at the prompt to continue installing OpenJDK 7.
Note that a shortcut to the JAVA_HOME directory, which we will need to configure Tomcat later, can be found at /usr/lib/jvm/jre.
Now that Java is installed, let's create a tomcat user, which will be used to run the Tomcat service.

Create Tomcat User

For security purposes, Tomcat should be run as an unprivileged user (i.e. not root). We will create a new user and group that will run the Tomcat service.
First, create a new tomcat group:
  • sudo groupadd tomcat
Then create a new tomcat user. We'll make this user a member of the tomcat group, with a home directory of /opt/tomcat (where we will install Tomcat), and with a shell of /bin/false (so nobody can log into the account):
  • sudo useradd -M -s /bin/nologin -g tomcat -d /opt/tomcat tomcat
Now that our tomcat user is set up, let's download and install Tomcat.

Install Tomcat

The easiest way to install Tomcat 8 at this time is to download the latest binary release then configure it manually.

Download Tomcat Binary

Find the latest version of Tomcat 8 at the Tomcat 8 Downloads page. At the time of writing, the latest version is 8.5.9. Under the Binary Distributions section, then under the Core list, copy the link to the "tar.gz".
Let's download the latest binary distribution to our home directory.
First, change to your home directory:
  • cd ~
Then use wget and paste in the link to download the Tomcat 8 archive, like this (your mirror link will probably differ from the example):
  • wget http://apache.mirrors.ionfish.org/tomcat/tomcat-8/v8.5.9/bin/apache-tomcat-8.5.9.tar.gz
We're going to install Tomcat to the /opt/tomcat directory. Create the directory, then extract the the archive to it with these commands:
  • sudo mkdir /opt/tomcat
  • sudo tar xvf apache-tomcat-8*tar.gz -C /opt/tomcat --strip-components=1
Now we're ready to set up the proper user permissions.

Update Permissions

The tomcat user that we set up needs to have the proper access to the Tomcat installation. We'll set that up now.
Change to the Tomcat installation path:
  • cd /opt/tomcat
Give the tomcat group ownership over the entire installation directory:
  • sudo chgrp -R tomcat /opt/tomcat
Next, give the tomcat group read access to the conf directory and all of its contents, and execute access to the directory itself:
  • sudo chmod -R g+r conf
  • sudo chmod g+x conf
Then make the tomcat user the owner of the webappsworktemp, and logs directories:
  • sudo chown -R tomcat webapps/ work/ temp/ logs/
Now that the proper permissions are set up, let's set up a Systemd unit file.

Install Systemd Unit File

Because we want to be able to run Tomcat as a service, we will set up a Tomcat Systemd unit file .
Create and open the unit file by running this command:
  • sudo vi /etc/systemd/system/tomcat.service
Paste in the following script. You may also want to modify the memory allocation settings that are specified in CATALINA_OPTS:
/etc/systemd/system/tomcat.service
# Systemd unit file for tomcat
[Unit]
Description=Apache Tomcat Web Application Container
After=syslog.target network.target

[Service]
Type=forking

Environment=JAVA_HOME=/usr/lib/jvm/jre
Environment=CATALINA_PID=/opt/tomcat/temp/tomcat.pid
Environment=CATALINA_HOME=/opt/tomcat
Environment=CATALINA_BASE=/opt/tomcat
Environment='CATALINA_OPTS=-Xms512M -Xmx1024M -server -XX:+UseParallelGC'
Environment='JAVA_OPTS=-Djava.awt.headless=true -Djava.security.egd=file:/dev/./urandom'

ExecStart=/opt/tomcat/bin/startup.sh
ExecStop=/bin/kill -15 $MAINPID

User=tomcat
Group=tomcat
UMask=0007
RestartSec=10
Restart=always

[Install]
WantedBy=multi-user.target
Save and exit. This script tells the server to run the Tomcat service as the tomcat user, with the settings specified.
Now reload Systemd to load the Tomcat unit file:
  • sudo systemctl daemon-reload
Now you can start the Tomcat service with this systemctl command:
  • sudo systemctl start tomcat
Check that the service successfully started by typing:
  • sudo systemctl status tomcat
If you want to enable the Tomcat service, so it starts on server boot, run this command:
  • sudo systemctl enable tomcat
Tomcat is not completely set up yet, but you can access the default splash page by going to your domain or IP address followed by :8080 in a web browser:
Open in web browser:
http://server_IP_address:8080
You will see the default Tomcat splash page, in addition to other information. Now we will go deeper into the installation of Tomcat.

Configure Tomcat Web Management Interface

In order to use the manager webapp that comes with Tomcat, we must add a login to our Tomcat server. We will do this by editing the tomcat-users.xml file:
  • sudo vi /opt/tomcat/conf/tomcat-users.xml
This file is filled with comments which describe how to configure the file. You may want to delete all the comments between the following two lines, or you may leave them if you want to reference the examples:
tomcat-users.xml excerpt

...

You will want to add a user who can access the manager-gui and admin-gui (webapps that come with Tomcat). You can do so by defining a user similar to the example below. Be sure to change the username and password to something secure:
tomcat-users.xml — Admin User

    admin
" password="password" roles="manager-gui,admin-gui"/>
Save and quit the tomcat-users.xml file.
By default, newer versions of Tomcat restrict access to the Manager and Host Manager apps to connections coming from the server itself. Since we are installing on a remote machine, you will probably want to remove or alter this restriction. To change the IP address restrictions on these, open the appropriate context.xml files.
For the Manager app, type:
  • sudo vi /opt/tomcat/webapps/manager/META-INF/context.xml
For the Host Manager app, type:
  • sudo vi /opt/tomcat/webapps/host-manager/META-INF/context.xml
Inside, comment out the IP address restriction to allow connections from anywhere. Alternatively, if you would like to allow access only to connections coming from your own IP address, you can add your public IP address to the list:
context.xml files for Tomcat webapps

  

Save and close the files when you are finished.
To put our changes into effect, restart the Tomcat service:
  • sudo systemctl restart tomcat

Access the Web Interface

Now that Tomcat is up and running, let's access the web management interface in a web browser. You can do this by accessing the public IP address of the server, on port 8080:
Open in web browser:
http://server_IP_address:8080
You will see something like the following image:
Tomcat root
As you can see, there are links to the admin webapps that we configured an admin user for.
Let's take a look at the Manager App, accessible via the link or http://server_IP_address:8080/manager/html:
Tomcat Web Application Manager
The Web Application Manager is used to manage your Java applications. You can Start, Stop, Reload, Deploy, and Undeploy here. You can also run some diagnostics on your apps (i.e. find memory leaks). Lastly, information about your server is available at the very bottom of this page.
Now let's take a look at the Host Manager, accessible via the link or http://server_IP_address:8080/host-manager/html/:
Tomcat Virtual Host Manager
From the Virtual Host Manager page, you can add virtual hosts to serve your applications from.

Conclusion

Your installation of Tomcat is complete! Your are now free to deploy your own Java web applications!

Friday, May 12, 2017

FreeBSD - adding user to wheel group

When u get the error below , just add the user to wheel group
$ su
su: Sorry


$ groups
ab003c

Login as root on the console:

# pw groupmod wheel -m ab003c

Sunday, March 26, 2017

install google chrome on centos 6

This worked for me:

https://tecadmin.net/install-google-chrome-in-centos-rhel-and-fedora/

Monday, February 27, 2017

migrating svn repo

svnadmin dump repoName > repo.dump
svnadmin create repoName
svnadmin load path/to/repoName < repo.dump

Wednesday, January 18, 2017

Install mod_wsgi with Apache on Centos 7

Install mod_wsgi 
(as root)
# yum install mod_wsgi
Now Edit the Apache configuration file to load the module
vi /etc/httpd/conf/httpd.conf
add the line (after the commented LoadModule example)
LoadModule wsgi_module modules/mod_wsgi.so

apachectl restart
or
systemctl restart httpd

Install Apache on Centos7

[root@hpcentos wb003c]# yum install httpd
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirrors.cat.pdx.edu
 * epel: linux.mirrors.es.net
 * extras: mirror.pac-12.org
 * updates: mirror.supremebytes.com
Package httpd-2.4.6-45.el7.centos.x86_64 already installed and latest version
Nothing to do

[root@hpcentos wb003c]# systemctl start httpd
[root@hpcentos wb003c]# systemctl enable httpd
Created symlink from /etc/systemd/system/multi-user.target.wants/httpd.service to /usr/lib/systemd/system/httpd.service.

[root@hpcentos wb003c]# firewall-cmd --add-service=http --permanent
success

[root@hpcentos wb003c]# firewall-cmd --reload
success

[root@hpcentos wb003c]#

Installing Django on Centos 7

Run below commands as root or sudo.  Root # prompt shown below.

# yum install epel-release

# yum install python34

# yum install python3-pip

# pip3 install --upgrade pip

# pip3 install virtualenv

As normal user

$ virtualenv --python=`which python3` ~/.virtualenvs/djangodev


Now close django.git in your git hub account.

then

git clone git@github.com:rakeshrp/django.git

where rakeshrp is my github user.


Now to install Django

(djangodev) [wb003c@hpcentos ~]$ pip3 install -e ./django/
Obtaining file:///home/wb003c/django
Collecting pytz (from Django==2.0.dev20170118203328)
  Downloading pytz-2016.10-py2.py3-none-any.whl (483kB)
    100% |████████████████████████████████| 491kB 2.2MB/s
Installing collected packages: pytz, Django
  Running setup.py develop for Django
Successfully installed Django pytz-2016.10
(djangodev) [wb003c@hpcentos ~]$


Run some tests

$ cd django/tests
$ ./runtests.py



Happy Web development :)




Monday, January 9, 2017

Multihop SSH with Putty and Socks5 Proxy

Requirement:
I wanted to access a server (Centos 7 on port 22421) at home behind a pfsense firewall and I was at work.
The pfsense firewall allowed traffic from an intermediate host but not from my machine at work.
The pfsense firewall was setup to allow traffic from my intermediate host with public key authentication
From work I could ssh to the intermediate host.
To access the pfsense GUI I had to use a browser and do a SOCKS5 proxy to the intermediate host and I wanted to setup a multihop ssh with putty to intermediate host and then to my home server.

I was able to setup SOCKS5 proxy and multihop ssh in putty in a single putty connection configuration.

I use a dynamic DNS to map a hostname to my dynamic IP provided by my ISP.
I have already done the step of port forwarding any SSH request that come on the ISP provided modem/router to my Centos 7 server.


  1. Start putty and on the “Session” page of the “Putty Configuration Dialog” that appears, fill in the host name and user name  for the final destination host (my Centos 7 server and port 22421). 
  2. Switch to the Connection –> Proxy page, select “Local” as the proxy type enter the following as the local proxy command: plink.exe intermediate.proxy.host -l username -agent -nc %host:%port
  3. go to Connection -> data and set the auto-login username 
  4. go to Connection -> SSH -> tunnels and setup dynamic port forwarding   Select Destination as Dynamic, source port as any number greater than 1024 , In my case i set it to 7002 in Source port field.         Click on ADD
  5. Save the session.


Now in Firefox setup Socks5 proxy


In Firefox Settings -> Options -> advanced -> Network settings -> Manual Proxy configurations 
Select SOCKS host as localhost , enter port as 7002 , choose Socks v5 radio button 
Click OK,


Now use putty to open the connection setup earlier and then in Firefox url type the url for Pfsense (In my case it was 10.0.0.1 ) and Viola my pfsense login screen comes up, 



partial source : http://mikelococo.com/2008/01/multihop-ssh/  for multihop through Putty.

Followers

About Me

Torrance, CA, United States