Category: Linux

  • Install Squid Proxy Server

    Proxy server allows hiding your IP address. You can find the Squid Proxy Installer script at

    https://github.com/serverok/squid-proxy-installer

    The script supports the following Operating systems

    • Ubuntu 18.04, 20.04, 22.04, 24.04
    • Debian 8, 9, 10, 11, 12, 13
    • CentOS 8
    • CentOS Steam 8, 9
    • AlmaLinux 8, 9

    Video Tutorial

    How to install Squid Proxy Server in DigitalOcean Droplet (VPS).

    https://rumble.com/vdswgv-install-squid-proxy-server-in-digitalocean-vps.html
    https://odysee.com/squid-proxy-install:1

    Become user root

    If you are not logged in as user root, you need to become user root. This can be done with the command

    sudo su

    If sudo su did not work for you, try

    su -

    Install wget

    On CentOS/AlmaLinix

    yum install -y wget

    On Ubuntu/Debian

    apt install -y wget

    install squid proxy server

    To install squid proxy server, run

    wget https://raw.githubusercontent.com/serverok/squid-proxy-installer/master/squid3-install.sh -O squid3-install.sh
    bash squid3-install.sh

    After installing Squid Proxy Server, you may need to change the port. For instructions, see How to change Port of Squid Proxy Server

    Create a Proxy User

    To create a user in squid proxy, run

    sudo squid-add-user

    To change the password for an existing user, just create the user again with a different password. This will update the existing user password.

    Configure Multiple IPs

    If you have multiple IP addresses on the server, first make sure IPs are properly configured on your web server. If your secondary IPs are configured, you should be able to ping to these IPs and connect to the server using the IP address.

    Once IPs are configured in the server and able to ping, you can run following commands

    wget https://raw.githubusercontent.com/serverok/squid-proxy-installer/master/squid-conf-ip.sh
    sudo bash squid-conf-ip.sh

    Now you will be able to use all IP available in the server as a proxy server.

    This won’t work if your IPs are behind NAT. You can verify this by running the command “ip a”, it should list all IP addresses.

    Test Proxy Server with curl

    curl -U PROXY_USER:PROXY_PW -x MY_PROXY_SERVER:PROXY_PORT https://checkip.amazonaws.com

    Related Posts

  • webmin create new admin user from command line

    webmin create new admin user from command line

    webmin

    PAM authentication failed n a webmin server with no errors on CentOS 6 server. To fix this, i created a nom PAM user “admin”.

    To add non PAM user, edit

    /etc/webmin/miniserv.users
    

    Add

    admin:mypassword
    

    Edit file

    vi /etc/webmin/webmin.acl
    

    Add

    admin: acl adsl-client ajaxterm apache at backup-config bacula-backup bandwidth bind8 burner change-user cluster-copy cluster-cron cluster-passwd cluster-shell cluster-software cluster-useradmin cluster-usermin cluster-webmin cpan cron custom dfsadmin dhcpd dovecot exim exports fail2ban fdisk fetchmail filemin file filter firewall6 firewalld firewall fsdump grub heartbeat htaccess-htpasswd idmapd inetd init inittab ipfilter ipfw ipsec iscsi-client iscsi-server iscsi-target iscsi-tgtd jabber krb5 ldap-client ldap-server ldap-useradmin logrotate lpadmin lvm mailboxes mailcap man mon mount mysql net nis openslp package-updates pam pap passwd phpini postfix postgresql ppp-client pptp-client pptp-server procmail proc proftpd qmailadmin quota raid samba sarg sendmail servers shell shorewall6 shorewall smart-status smf software spam squid sshd status stunnel syslog syslog-ng system-status tcpwrappers telnet time tunnel updown useradmin usermin vgetty webalizer webmincron webminlog webmin wuftpd xinetd virtual-server virtualmin-awstats jailkit virtualmin-htpasswd virtualmin-sqlite virtualmin-dav ruby-gems virtualmin-git php-pear virtualmin-init virtualmin-slavedns virtualmin-registrar
    

    Set a password for user admin.

    /usr/libexec/webmin/changepass.pl /etc/webmin admin  PASSWORD_HERE
    

    Now you will be able to login to webmin at

    https://your-server-ip:10000
    User = admin
    PW = password you used in above step
    
  • Comment multiple lines in vim

    To comment multiple lines in vim, first select the line in visual mode.

    To change mode to visual mode, type

    v
    

    Now use j/k keys to select lines of text you need to comment.

    To comment

    To comment, use :norm command.

    :norm i#
    

    This will insert # to start of every line.

    When you type :norm, in visual mode, you will see

    :'<,'>norm i#
    

    Uncomment

    To uncomment, select the lines in visual mode. Then run

    :norm x
    

    this will delete first chars from every selected lines.

    Method 2

    You can use CTRL + V, this will select first char only.

    To comment

    1) Get into VISUAL_BLOCK mode by pressing CTRL + V
    2) use j/k keys to select lines to comment.
    3) Press SHIFT + I, now type #
    4) Press ESC

    To uncomment

    1) Get into VISUAL_BLOCK mode by pressing CTRL + V
    2) use j/k keys to select lines to comment.
    3) Press x

  • Install InterPlanetary File System (IPFS)

    Install InterPlanetary File System (IPFS)

    InterPlanetary File System (IPFS) is a peer-peer Distributed file system allow nodes to join and share files.

    https://ipfs.io

    To install IPFS, download latest version of IPFS for your Operating System from

    https://dist.ipfs.io/#go-ipfs

    For Ubuntu/Linux

    cd /usr/loca/src
    wget https://dist.ipfs.io/go-ipfs/v0.4.18/go-ipfs_v0.4.18_linux-amd64.tar.gz
    tar xvf go-ipfs_v0.4.18_linux-amd64.tar.gz
    cd go-ipfs
    ./install.sh
    

    Once installed, initialize IPFS server with command

    ipfs init --profile server
    

    Start ipfs server with

    ipfs daemon
    

    You can see all peers connected to your server with command

    ipfs swarm peers
    
  • Yum disable a repository

    To disable a repository, run

    yum-config-manager --disable REPO_NAME_HERE
    

    To list all enabled repository, run

    yum repolist
    
  • Large file upload in PHP

    To allow large file upload in PHP, you need to edit php.ini file and change fllowing settings

    memory_limit = 512M
    upload_max_filesize = 800M
    post_max_size = 800M
    max_input_time = 6000
    max_execution_time = 600
    

    If you have Dedicated or VPS, you can edit php.ini file using ssh. To find location of this file, upload a phpinfo page to your server, that will display location of php.ini used by your web site.

    Some control panel like CPanel have option to edit php.ini settings.

  • Reverse proxy

    Reverse proxy sit in front of a web server. All traffic come to reverse proxy, then reverse proxy route traffic to one or more backend web servers.

    Nginx and Vranish are popular software used as reverse proxy.

    Show Real IP

  • ArchLinux Package Management with pacman

    To update packages, run

    pacman -Syu
    

    To install a software, run

    pacman -S PKG_NAME
    

    To search for a package

    pacman -Ss PKG_NAME
    

    Show information about a specific package

    pacman -Si PKG_NAME
    

    To get list of all files installed by a package

    pacman -Fl PKG_NAME
    pacman -Ql PKG_NAME
    

    To verify presence of all files installed by a package

    pacman -Qk PKG_NAME
    

    To find which package provide a file

    pacman -Fsy FILE_NAME
    

    Example

    [root@PAR-139278 ~]# pacman -Fsy apachectl
    :: Synchronizing package databases...
     core is up to date
     extra is up to date
     community is up to date
    extra/apache 2.4.39-1
        usr/bin/apachectl
    [root@PAR-139278 ~]# 
    
  • Install ruby from source

    Install ruby from source

    Ruby Programming

    Download latest version of ruby source code from

    https://www.ruby-lang.org/en/downloads/

    At the time of writing this, latest version is 2.6.0

    cd /usr/local/src
    wget https://cache.ruby-lang.org/pub/ruby/2.6/ruby-2.6.0.tar.gz
    tar -zxvf ruby-2.6.0.tar.gz
    cd ruby-2.6.0
    ./configure
    make
    make install