Search This Blog

Showing posts with label Ubuntu. Show all posts
Showing posts with label Ubuntu. Show all posts

Wednesday, August 26, 2026

Turbocharging Nginx on Oracle Cloud ARM: Zero-Copy HTTPS with Kernel TLS (kTLS)

Turbocharging Nginx on Oracle Cloud ARM: Zero-Copy HTTPS with Kernel TLS (kTLS)

If you run high-concurrency web applications, media assets, or content management systems like WordPress on Oracle Cloud Infrastructure (OCI) Ampere Altra (ARM64) instances, you are already benefiting from high core counts and efficient compute.

However, serving static assets over HTTPS standardly incurs an invisible system tax: redundant memory copying and excessive CPU context switches.

By offloading symmetric TLS record processing directly to the Linux kernel via Kernel TLS (kTLS), you unlock true zero-copy sendfile() over HTTPS, slashing CPU overhead and maximizing throughput on Ubuntu 24.04 LTS.


The Hidden Bottleneck of User-Space HTTPS

In a traditional Nginx setup serving encrypted traffic:

[Disk / Page Cache] ──(Copy 1)──> [User Space: Nginx / OpenSSL]
                                           │
                                    (Encrypts Data)
                                           │
[Network Interface (NIC)] <──(Copy 2)── [Kernel Socket Buffer]
  1. The kernel reads requested files from disk or page cache into user-space memory buffers.
  2. OpenSSL in user space encrypts the payload block by block.
  3. Encrypted buffers are copied across the user/kernel space boundary into socket buffers.
  4. The network stack finally transmits the packets over the wire.

Because OpenSSL processes symmetric encryption in user space, the Linux kernel's high-performance sendfile() syscall is disabled for HTTPS. Every static asset—images, cached HTML, CSS, JavaScript, and binaries—triggers double memory copies and CPU cache invalidations.


How kTLS Solves the Problem

Kernel TLS cleanly separates the control plane from the data plane:

  • Handshake (Control Plane): Remains entirely in user space. OpenSSL handles certificate validation, key exchange, and session negotiation.
  • Data Plane (Encryption/Decryption): Once session keys are derived, OpenSSL passes them to the kernel via socket options (setsockopt(..., SOL_TLS, ...)). The socket switches to the tls Upper Layer Protocol (ULP).
[Disk / Page Cache] ──(In-Kernel Zero-Copy sendfile)──> [Kernel Crypto: ARM CE] ──> [NIC]

With kTLS active, Nginx issues a standard sendfile() syscall over HTTPS. The kernel reads directly from page cache, applies symmetric encryption (AES-GCM or ChaCha20-Poly1305) in-kernel using ARMv8 Neoverse N1 Cryptographic Extension instructions, and streams packets directly to the network interface. Zero user-space memory copies.


Prerequisites on Ubuntu 24.04 LTS (ARM64)

  • OS: Ubuntu 24.04 LTS (Kernel 6.8+ with CONFIG_TLS=m enabled by default)
  • Hardware: OCI Ampere Altra (ARMv8.2+ with hardware-accelerated AES/SHA Cryptographic Extensions)
  • Software: Nginx with OpenSSL 3.x

Step-by-Step Implementation & Common Pitfalls

1. Load and Persist the Kernel Module

The tls module is included in Ubuntu 24.04 but must be loaded:

# Load module immediately
sudo modprobe tls

# Persist module across reboots
echo "tls" | sudo tee /etc/modules-load.d/ktls.conf

Verify that the module is loaded:

lsmod | grep tls

2. The Nginx Configuration Pitfall

Many online guides suggest adding this directive to /etc/nginx/nginx.conf:

ssl_conf_cmd Options KTLS;

On standard Ubuntu 24.04 builds, running nginx -t will often throw an error:

[emerg] unknown directive "ssl_conf_cmd" in /etc/nginx/nginx.conf
nginx: configuration file /etc/nginx/nginx.conf test failed

The Fix: Do not place ssl_conf_cmd in Nginx. Instead, configure OpenSSL 3.x system-wide so all Nginx worker processes automatically use kTLS.

3. Enable kTLS via OpenSSL 3.x Configuration

Open /etc/ssl/openssl.cnf:

sudo nano /etc/ssl/openssl.cnf

Step A: Locate the existing [openssl_init] block (around line 43) and add ssl_conf = ssl_sect:

[openssl_init]
providers = provider_sect
ssl_conf = ssl_sect

Step B: Scroll to the very bottom of the file and append the SSL section:

[ssl_sect]
system_default = system_default_sect

[system_default_sect]
CipherString = DEFAULT:@SECLEVEL=2
Options = KTLS

Save and exit the file.

4. Configure Nginx and Restart

Ensure your /etc/nginx/nginx.conf has sendfile and modern TLS protocols enabled:

http {
    sendfile on;
    tcp_nopush on;
    tcp_nodelay on;

    ssl_protocols TLSv1.2 TLSv1.3;
    ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384;
    ssl_prefer_server_ciphers off;

    # ... remaining server configurations ...
}

Test configuration and restart the service:

sudo nginx -t && sudo systemctl restart nginx

Verifying kTLS in Production

Generate test HTTPS traffic against your server:

curl -k -o /dev/null https://127.0.0.1/

1. Check Kernel TLS Statistics

Inspect the kernel's real-time TLS statistics:

cat /proc/net/tls_stat

Key counters to watch:

  • TlsTxSw: Increments with every TLS record encrypted via software crypto routines in the kernel.
  • TlsCurrTxSw: Shows currently active kernel TLS transmit sockets.

2. Inspect Active Socket Offload

Run ss to verify that active connections use the TLS Upper Layer Protocol:

ss -ti '( sport = :443 or dport = :443 )'

Look for ulp:tls in the socket options output.


Performance Comparison

Metric Standard TLS (User Space) Kernel TLS (kTLS Zero-Copy)
Data Path 2 Buffer Copies (Kernel $\rightarrow$ User $\rightarrow$ Kernel) 0 Copies (Direct Page Cache $\rightarrow$ NIC)
sendfile() Syscall Disabled for HTTPS Fully Supported
CPU Overhead High %usr (User space encryption) Low %usr, shifts cleanly to %sys
Throughput Memory bandwidth bound Line-rate network bound

Summary

Enabling kTLS on Oracle Cloud ARM instances is a zero-cost optimization that yields substantial returns for static file delivery. By fixing the OpenSSL 3.x system configuration on Ubuntu 24.04, you eliminate user-space copy bottlenecks and allow the ARM Neoverse crypto engine to process encrypted traffic at native line rates.

Tuesday, October 8, 2024

Fix keyboard lag/input delay on Ubuntu, Debian and Redhat in VMware workstation 17

I experiencing this problem with Ubuntu, Debian, Redhat in VMware workstation version 17.

I tried all these, none works:
  • Enhanced keyboard on and off
  • Turned 3D Acceleration on and off
  • Install VMware Tools Desktop
  • Set memory allocated to 100%

Finally, turn on the "Virtualize IOMMU (IO memory management unit) under [Virtualization engin] under "Processors" like this fixed the issue.

Monday, April 22, 2024

Converting QCow2 disk image to VMDK for VMware

In Ubuntu 22.04, install qemu-img command:
apt install qemu-utils
Download QCow2 UEFI/GPT Bootable disk image:
wget https://cloud-images.ubuntu.com/minimal/releases/jammy/release/ubuntu-22.04-minimal-cloudimg-amd64.img
Converting qcow2 disk image to vmdk for VMware:
qemu-img convert -f qcow2 -O vmdk ubuntu-22.04-minimal-cloudimg-amd64.img ubuntu-22.04-minimal-cloudimg-amd64.vmdk

Monday, May 8, 2023

configure logrotate to not delete log files after rotation

copy: Make a copy of the log file, but don’t change the original at all.
copytruncate: Truncate the original log file in place after creating a copy.

An example: /etc/logrotate.d/mds
/var/log/mds/mds-app-*.log {
    daily
    copytruncate
    rotate 30
    dateext
    missingok
    notifempty
    sharedscripts
}

Tuesday, May 2, 2023

Debian network performance tweak

Increase network read and write buffer on debian/Ubuntu server:

Add 2 lines at the end of /etc/sysctl.conf:
# Socket Receive Buffer
net.core.rmem_max = 4194304
# Socket Send Buffer
net.core.wmem_max = 16777216
load the changes:
sudo sysctl -p

4194304 = 4 MB
16777216 = 16 MB

Tuesday, March 28, 2023

Block / Frobid a package installation on Debian

Try to block apparmor automatic install everything doing apt dist-upgrade.

Create a file: /etc/apt/preferences.d/99-apparmor
Package: apparmor
Pin: release *
Pin-Priority: -1
Reference: https://wiki.debian.org/AptConfiguration#Prevent.2Fselective_installation_from_third-party_a_repository

Tuesday, October 11, 2022

Fix Ubuntu/Debian server [Systemd Timesyncd Time] checkmk alert [Cannot reasonably calculate time since last synchronization (hosts time is running ahead)]

My checkmk server through alert on Ubuntu/Debian servers: Cannot reasonably calculate time since last synchronization (hosts time is running ahead)
# systemctl status systemd-timesyncd.service
● systemd-timesyncd.service - Network Time Synchronization
   Loaded: loaded (/lib/systemd/system/systemd-timesyncd.service; enabled; vendor preset: enabled)
  Drop-In: /usr/lib/systemd/system/systemd-timesyncd.service.d
           └─disable-with-time-daemon.conf
   Active: active (running) since Mon 2022-09-26 17:47:50 EDT; 2 weeks 1 days ago
     Docs: man:systemd-timesyncd.service(8)
 Main PID: 443 (systemd-timesyn)
   Status: "Synchronized to time server for the first time 208.81.1.244:123 (0.debian.pool.ntp.org)."
    Tasks: 2 (limit: 4722)
   Memory: 1.7M
   CGroup: /system.slice/systemd-timesyncd.service
           └─443 /lib/systemd/systemd-timesyncd

Sep 26 17:47:50 Minecraft systemd[1]: Starting Network Time Synchronization...
Sep 26 17:47:50 Minecraft systemd[1]: Started Network Time Synchronization.
Sep 26 17:47:50 Minecraft systemd-timesyncd[443]: Synchronized to time server for the first time 208.81.1.244:123 (0.debian.pool.ntp.org).
Update the configuration: /etc/systemd/timesyncd.conf
[Time]
NTP=ca.pool.ntp.org
FallbackNTP=0.debian.pool.ntp.org 1.debian.pool.ntp.org 2.debian.pool.ntp.org 3.debian.pool.ntp.org
RootDistanceMaxSec=5
PollIntervalMinSec=32
PollIntervalMaxSec=2048
Restart the systemd-timesyncd.service
root@Minecraft:~# systemctl restart systemd-timesyncd.service
root@Minecraft:~# systemctl status systemd-timesyncd.service
● systemd-timesyncd.service - Network Time Synchronization
   Loaded: loaded (/lib/systemd/system/systemd-timesyncd.service; enabled; vendor preset: enabled)
  Drop-In: /usr/lib/systemd/system/systemd-timesyncd.service.d
           └─disable-with-time-daemon.conf
   Active: active (running) since Tue 2022-10-11 20:11:36 EDT; 3s ago
     Docs: man:systemd-timesyncd.service(8)
 Main PID: 1796 (systemd-timesyn)
   Status: "Synchronized to time server for the first time 209.115.181.110:123 (ca.pool.ntp.org)."
    Tasks: 2 (limit: 4722)
   Memory: 1.3M
   CGroup: /system.slice/systemd-timesyncd.service
           └─1796 /lib/systemd/systemd-timesyncd

Oct 11 20:11:36 Minecraft systemd[1]: Starting Network Time Synchronization...
Oct 11 20:11:36 Minecraft systemd[1]: Started Network Time Synchronization.
Oct 11 20:11:36 Minecraft systemd-timesyncd[1796]: Synchronized to time server for the first time 209.115.181.110:123 (ca.pool.ntp.org).

Friday, June 22, 2018

add Volume indicator for xUbuntu 16.04 LTS

Running xUbuntu 16.04 LTS on VMware.

I am a less is better person, so did no have sound card at begining.

After add sound card, found there is no Volume indicator on Panel as an option.

I am using pulseaudio server for sound in xUbuntu.
apt-get install xfce4-pulseaudio-plugin

Logout then Login.

Now you can add the Volume indicator on the Panel.

Sunday, July 16, 2017

Ubuntu Server 16.04 firewall UFW configure

Ubuntu using UFW, I found it is easy to config for most of the people.

Here is my basic example configure:

First install ufw:
apt-get install ufw

Which also installed the iptables package.

Then check the status:

ufw status


Shout be disabled for fresh setup.

Next all my configure and enable ufw at the END:
ufw default deny incoming
ufw default allow outgoing
ufw allow 80
ufw allow 443
ufw allow from vpn.milliondollarserver.com
ufw enable


Final status should looks like this:
# ufw status verbose
Status: active
Logging: on (low)
Default: deny (incoming), allow (outgoing), disabled (routed)
New profiles: skip

To                         Action      From
--                         ------      ----
80                         ALLOW IN    Anywhere
443                        ALLOW IN    Anywhere
Anywhere                   ALLOW IN    vpn.milliondollarserver.com
80 (v6)                    ALLOW IN    Anywhere (v6)
443 (v6)                   ALLOW IN    Anywhere (v6)

Clean up Ubuntu Server 16.04 after installation

Just want share my first todo after a fresh new Ubuntu Server 16.04 installation:
apt purge ubuntu-server ubuntu-minimal
apt purge lvm2 mdadm plymouth lxd lxcfs snapd open-iscsi
apt purge snap-confine snapd ubuntu-core-launcher
apt purge lxc-common liblxc1 vlan
apt purge grub-legacy-ec2 lxd-client btrfs-tools
apt purge xfsprogs

Remember check the file list before remove it if you are not sure what the package does:
dpkg -L

I do this on a VM, therefor:

1.No require of LVM, because I just using the bare EXT4 filesystem.
2.MDadm for raid, no need for a VM.
3.LXD and SNAP, I don't need run vms inside this VM.
4.grub-legacy-ec2 is for Amazon EC2, since this is a VMware VM it can be purge.

Only do these if you know what you are doing, run by your own risk.

Please let me know if you have any questions.

Friday, February 24, 2017

HHVM 3.18.0 crash on Ubuntu 16.04 with Nginx

Just try to bring up an new HHVM host on Ubuntu 16.04 with Nginx.

But HHVM keep crush error in /var/log/hhvm/error.log
It created error log in /tmp

Here is a example:


ProcessID: 1549
ThreadID: 140594705856256
ThreadPID: 2188
Name: unknown program
Type: Aborted
Runtime: hhvm
Version: tags/HHVM-3.18.0-0-g9b285191feb2bb1558bb6682da135263bd2a9e60
DebuggerCount: 0

ThreadType: Web Request
Assertion Message: Failed to initialize central HHBC repository:
Failed to initialize schema in /var/run/hhvm/hhvm.hhbc(rw-r--r-- root:root):
Failed to open /var/www/.hhvm.hhbc: 14 - unable to open database file

Assertion Failure: /tmp/tmp.Fv54re7NgD/hphp/runtime/vm/repo.cpp:562: HPHP::Repo::initCentral()::__lambda62: assertion `false' failed.
URL: /wp-admin/admin-ajax.php



Run ls -alt /var/run/hhvm
Since upgrading to 3.18, hhvm is unable to open hhvm.hhbc as it is created as root instead of www-data.

For now the workaround is to add the following to your configuration: /etc/hhvm/server.ini


hhvm.repo.central.file_user=www-data
hhvm.repo.central.file_group=www-data
hhvm.repo.central.file_mode=493



Restart the HHVM service.

And it works.

Hope HHVM team can fix it in the next release.


Reference: https://github.com/facebook/hhvm/issues/7674

Saturday, June 11, 2016

HHVM 3.14 update missing error while loading shared libraries: libdouble-conversion.so.1 and liblz4.so.1

One of my Ubuntu 14.04 LTS server running HHVM for a while.
Recently the 3.14 update just came, after upgrade the HHVM won't start:


root@milliondollarserver:~# apt-get dist-upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
The following packages will be upgraded:
hhvm
1 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 18.6 MB of archives.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://dl.hhvm.com/ubuntu/ trusty/main hhvm amd64 3.14.0~trusty [18.6 MB]
Fetched 18.6 MB in 1s (10.3 MB/s)
(Reading database ... 92960 files and directories currently installed.)
Preparing to unpack .../hhvm_3.14.0~trusty_amd64.deb ...
********************************************************************
* HHVM is being removed. You can remove it from your webserver with:
*
* $ sudo /usr/share/hhvm/uninstall_fastcgi.sh
* $ sudo /etc/init.d/nginx restart
* $ sudo /etc/init.d/apache restart
********************************************************************
Unpacking hhvm (3.14.0~trusty) over (3.13.2~trusty) ...
Processing triggers for ureadahead (0.100.0-16) ...
ureadahead will be reprofiled on next reboot
Setting up hhvm (3.14.0~trusty) ...
update-alternatives: using /usr/bin/hhvm to provide /usr/bin/php (php) in auto mode
********************************************************************
* HHVM is installed.
*
* Running PHP web scripts with HHVM is done by having your
* webserver talk to HHVM over FastCGI. Install nginx or Apache,
* and then:
* $ sudo /usr/share/hhvm/install_fastcgi.sh
* $ sudo /etc/init.d/hhvm restart
* (if using nginx) $ sudo /etc/init.d/nginx restart
* (if using apache) $ sudo /etc/init.d/apache restart
*
* Detailed FastCGI directions are online at:
* https://github.com/facebook/hhvm/wiki/FastCGI
*
* If you're using HHVM to run web scripts, you probably want it
* to start at boot:
* $ sudo update-rc.d hhvm defaults
*
* Running command-line scripts with HHVM requires no special setup:
* $ hhvm whatever.php
*
* You can use HHVM for /usr/bin/php even if you have php-cli
* installed:
* $ sudo /usr/bin/update-alternatives \
* --install /usr/bin/php php /usr/bin/hhvm 60
********************************************************************
/usr/bin/hhvm: error while loading shared libraries: libdouble-conversion.so.1: cannot open shared object file: No such file or directory
root@milliondollarserver:~# service hhvm restart
* Restarting HHVM FastCGI Daemon hhvm
/usr/bin/hhvm: error while loading shared libraries: libdouble-conversion.so.1: cannot open shared object file: No such file or directory


Than I installed the libdouble-conversion library:

root@milliondollarserver:~# apt-cache search libdouble
libdouble-conversion1 - routines to convert IEEE floats to and from strings
libdouble-conversion-dbg - routines to convert IEEE floats to and from strings (debugging symbols)
libdouble-conversion-dev - routines to convert IEEE floats to and from strings (development files)
root@milliondollarserver:~# apt-get install libdouble-conversion1
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
libdouble-conversion1
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 31.5 kB of archives.
After this operation, 104 kB of additional disk space will be used.
Get:1 http://ca.archive.ubuntu.com/ubuntu/ trusty/universe libdouble-conversion1 amd64 2.0.1-1 [31.5 kB]
Fetched 31.5 kB in 0s (96.7 kB/s)
Selecting previously unselected package libdouble-conversion1:amd64.
(Reading database ... 92960 files and directories currently installed.)
Preparing to unpack .../libdouble-conversion1_2.0.1-1_amd64.deb ...
Unpacking libdouble-conversion1:amd64 (2.0.1-1) ...
Setting up libdouble-conversion1:amd64 (2.0.1-1) ...
Processing triggers for libc-bin (2.19-0ubuntu6.9) ...


But still no luck:

root@milliondollarserver:~# service hhvm start
/usr/bin/hhvm: error while loading shared libraries: liblz4.so.1: cannot open shared object file: No such file or directory
root@milliondollarserver:~# service hhvm restart
* Restarting HHVM FastCGI Daemon hhvm
/usr/bin/hhvm: error while loading shared libraries: liblz4.so.1: cannot open shared object file: No such file or directory


I have to install liblz4 to fix it:


root@milliondollarserver:~# apt-cache search liblz4
liblz4-1 - Fast LZ compression algorithm library - runtime
liblz4-1-dbg - Fast LZ compression algorithm library - Debugging Symbols
liblz4-dev - Fast LZ compression algorithm library - development files
liblz4-tool - Fast LZ compression algorithm library - tool
root@milliondollarserver:~# apt-get install liblz4-1
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
liblz4-1
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 16.1 kB of archives.
After this operation, 72.7 kB of additional disk space will be used.
Get:1 http://ca.archive.ubuntu.com/ubuntu/ trusty/universe liblz4-1 amd64 0.0~r114-2ubuntu1 [16.1 kB]
Fetched 16.1 kB in 0s (55.5 kB/s)
Selecting previously unselected package liblz4-1:amd64.
(Reading database ... 92966 files and directories currently installed.)
Preparing to unpack .../liblz4-1_0.0~r114-2ubuntu1_amd64.deb ...
Unpacking liblz4-1:amd64 (0.0~r114-2ubuntu1) ...
Setting up liblz4-1:amd64 (0.0~r114-2ubuntu1) ...
Processing triggers for libc-bin (2.19-0ubuntu6.9) ...
root@milliondollarserver:~# service hhvm start


I noticed my Debian 8 Jessie server doesn't have this issue, only the Ubuntu 14.04 LTS.

Just a heads up for every one test your code and server before you upgrade the production system.

I like (not love anymore, since version 3.10) HHVM, but it got some quality issues since Version 3.10.
Hope it just a temporary thing.

I will keep support HHVM but not suggest it in production system.


Have a nice weekend!

Monday, April 4, 2016

FreeRDP redirect Sound Audio Ubuntu

I need able to hear from the Windows Remote Desktop applications from FreeRDP in Ubuntu 14.04.

Here is my script:


#!/bin/sh

# To Fit Screen Resloution
Xaxis=$(xrandr --current | grep '*' | uniq | awk '{print $1}' | cut -d 'x' -f1)
Yaxis=$(xrandr --current | grep '*' | uniq | awk '{print $1}' | cut -d 'x' -f2)

MaxRes=$(($Xaxis))"x"$(($Yaxis-50))

# Remote Desktop
xfreerdp -g $MaxRes --plugin cliprdr -u $USERNAME -p $PASSWD -d $DOMAIN --plugin rdpsnd --data alsa -- $1 > /tmp/xfreerdp.log



Reference:
https://github.com/FreeRDP/FreeRDP
https://github.com/FreeRDP/FreeRDP/wiki/PreBuilds
https://github.com/FreeRDP/FreeRDP/issues/1540
https://github.com/FreeRDP/FreeRDP/wiki/Plugins
http://unix.stackexchange.com/questions/153552/linux-rdp-with-audio-and-mic
http://osdir.com/ml/freerdp-devel-remote-desktop-protocol/2011-08/msg00115.html

Friday, April 1, 2016

Force Citrix Receiver for Linux not in full screen

Follow the Citrix Receiver for Linux OEM’s Reference Guide
https://www.citrix.com/content/dam/citrix/en_us/documents/downloads/citrix-receiver/linux-oem-guide-13-0-bk.pdf

I changed 3 parameters to force Citrix Receiver not start Full Screen but 1024*768 windowed.


#
sed -i 's/UseFullScreen=\*/UseFullScreen=False/g' /etc/icaclient/config/All_Regions.ini
sed -i 's/DesiredHRES=\*/DesiredHRES=1024/g' /etc/icaclient/config/All_Regions.ini
sed -i 's/DesiredVRES=\*/DesiredVRES=768/g' /etc/icaclient/config/All_Regions.ini



Please notice if you already run the Citrix Receiver by local "User", you may have to change the file in the /home/USERNAME/.ICACLIENT/config/All_Regions.ini


#
sed -i 's/UseFullScreen=\*/UseFullScreen=False/g' ~/.ICACLIENT/config/All_Regions.ini
sed -i 's/DesiredHRES=\*/DesiredHRES=1024/g' ~/.ICACLIENT/config/All_Regions.ini
sed -i 's/DesiredVRES=\*/DesiredVRES=768/g' ~/.ICACLIENT/config/All_Regions.ini

Saturday, February 27, 2016

Linux Half-Life Dedicated Server Counter-Strike Server

Note 0: The old hldsupdatetool not longer works!!!!

It's a lot to cover.
For now, only reference links:

https://developer.valvesoftware.com/wiki/SteamCMD
https://developer.valvesoftware.com/wiki/Dedicated_Servers_List

https://developer.valvesoftware.com/wiki/Half-Life_Dedicated_Server
http://www.howtodoityourself.org/how-to-install-counter-strike-server.html
http://forums.absurdminds.net/viewtopic.php?f=18&t=423
https://support.steampowered.com/kb_article.php?ref=6470-EIFV-5481#start

I spin an new Ubuntu VM.
Note 1: 32bit is easier because of no lib32gcc1 required.
Download SteamCMD.


cd ~/steamcmd
./steamcmd.sh
login anonymous
force_install_dir ./cs_go/



Note 2: for Counter-Strike: Condition Zero Dedicated Server

app_set_config 90 mod czero
app_update 90 validate



Note 3: for Counter-Strike Global Offensive Dedicated Server

app_update 740 validate



Note 4: for Counter-Strike: Source Dedicated Server

app_update 232330 validate

Friday, April 24, 2015

Cisco VPN on Ubuntu 14.04 pcf convert to vpnc.conf


  1. First Install vpnc client


  2. # apt-get install network-manager-vpnc

  3. Then convert a pcf to a vpnc configuration


  4. # pcf2vpnc mds.pcf vpnc.conf

  5. Copy the file to /etc/vpnc.conf then run vpnc


  6. # cp vpnc.conf /etc/vpnc.conf
    # vpnc

  7. To disconnect vpn connection


  8. # vpnc-disconnect

Friday, November 14, 2014

Magento on HHVM 3.3 Nginx 1.6 on Ubuntu 14.04 trusty

No more Varnish! Love HHVM!

1.First this VPS box running Ubuntu 14.04 trusty 64 bit with 2 GB Memory and 2 Core CPU.
Please follow HHVM, Nginx and MariaDB 's offical installation guide to install:





After installation I have these files under /etc/apt/sources.list.d/:
nginx.list
deb http://nginx.org/packages/ubuntu/ trusty nginx


mariadb.list
deb http://mariadb.mirror.iweb.com//repo/10.0/ubuntu trusty main


hhvm.list
deb http://dl.hhvm.com/ubuntu trusty main


At this moment I have the version:

root@mds-magento:/var/www/magento/includes# dpkg -l|grep hhvm
ii hhvm 3.3.0~trusty amd64 HHVM virtual machine, runtime, and JIT for the PHP language
root@mds-magento:/var/www/magento/includes# dpkg -l|grep nginx
ii nginx 1.6.2-1~trusty amd64 high performance web server
root@mds-magento:/etc/apt/sources.list.d# dpkg -l|grep mariadb
ii libmariadbclient18 10.0.14+maria-1~trusty amd64 MariaDB database client library
ii mariadb-client-10.0 10.0.14+maria-1~trusty amd64 MariaDB database client binaries
ii mariadb-client-core-10.0 10.0.14+maria-1~trusty amd64 MariaDB database core client binaries
ii mariadb-common 10.0.14+maria-1~trusty all MariaDB database common files (e.g. /etc/mysql/conf.d/mariadb.cnf)
ii mariadb-server 10.0.14+maria-1~trusty all MariaDB database server (metapackage depending on the latest version)
ii mariadb-server-10.0 10.0.14+maria-1~trusty amd64 MariaDB database server binaries
ii mariadb-server-core-10.0 10.0.14+maria-1~trusty amd64 MariaDB database core server files


2.Share my Nginx config file:
/etc/nginx/nginx.conf


user www-data;
worker_processes 2;

error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;


events {
worker_connections 1024;
}


http {
include /etc/nginx/mime.types;
default_type application/octet-stream;

log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';

access_log /var/log/nginx/access.log main;

sendfile on;
autoindex off;
#tcp_nopush on;

map $scheme $fastcgi_https { ## Detect when HTTPS is used
default off;
https on;
}

keepalive_timeout 10;

gzip on;
gzip_comp_level 2;
gzip_proxied any;
gzip_types text/plain text/css application/x-javascript application/xml application/xml+rss text/javascript;

include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}


/etc/nginx/hhvm.conf

location ~ .(hh|php)$ {
fastcgi_keep_conn on;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}


/etc/nginx/fastcgi_params


fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;

fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_param REQUEST_URI $request_uri;
fastcgi_param DOCUMENT_URI $document_uri;
fastcgi_param DOCUMENT_ROOT $document_root;
fastcgi_param SERVER_PROTOCOL $server_protocol;
fastcgi_param HTTPS $https if_not_empty;

fastcgi_param GATEWAY_INTERFACE CGI/1.1;
fastcgi_param SERVER_SOFTWARE nginx/$nginx_version;

fastcgi_param REMOTE_ADDR $remote_addr;
fastcgi_param REMOTE_PORT $remote_port;
fastcgi_param SERVER_ADDR $server_addr;
fastcgi_param SERVER_PORT $server_port;
fastcgi_param SERVER_NAME $server_name;

# PHP only, required if PHP was built with --enable-force-cgi-redirect
fastcgi_param REDIRECT_STATUS 200;


/etc/nginx/sites-enabled/magento

server {
listen 80;
server_name localhost;
rewrite / $scheme://www.$host$request_uri permanent; ## Forcibly prepend a www
}

server {
listen 80 default;

#charset koi8-r;
#access_log /var/log/nginx/log/host.access.log main;

root /var/www/magento;

location / {
index index index.html index.htm index.php;
try_files $uri $uri/ @handler;
}

## These locations would be hidden by .htaccess normally
location ^~ /app/ { deny all; }
location ^~ /includes/ { deny all; }
location ^~ /lib/ { deny all; }
location ^~ /media/downloadable/ { deny all; }
location ^~ /pkginfo/ { deny all; }
location ^~ /report/config.xml { deny all; }
location ^~ /var/ { deny all; }

location /. { ## Disable .htaccess and other hidden files
return 404;
}

location @handler { ## Magento uses a common front handler
rewrite / /index.php;
}

location ~ .php/ { ## Forward paths like /js/index.php/x.js to relevant handler
rewrite ^(.*.php)/ $1 last;
}

location ~ .php$ { ## Execute PHP scripts
if (!-e $request_filename) { rewrite / /index.php last; } ## Catch 404s that try_files miss

expires off; ## Do not cache dynamic content
fastcgi_keep_conn on;
fastcgi_pass unix:/var/run/hhvm/hhvm.sock;
fastcgi_index index.php;
fastcgi_param HTTPS $fastcgi_https;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param MAGE_RUN_CODE default; ## Store code is defined in administration > Configuration > Manage Stores
fastcgi_param MAGE_RUN_TYPE store;
include fastcgi_params; ## See /etc/nginx/fastcgi_params
}
}


3.My HHVM config file:

/etc/hhvm/server.ini

; php options

pid = /var/run/hhvm/pid

; hhvm specific

;hhvm.server.port = 9000
hhvm.server.file_socket = /var/run/hhvm/hhvm.sock
hhvm.server.type = fastcgi
hhvm.server.default_document = index.php
hhvm.log.use_log_file = true
hhvm.log.file = /var/log/hhvm/error.log
hhvm.repo.central.path = /var/run/hhvm/hhvm.hhbc


/etc/hhvm/php.ini

; php options

; hhvm specific
hhvm.log.level = Warning
hhvm.log.always_log_unhandled_exceptions = true
hhvm.log.runtime_error_reporting_level = 8191
hhvm.mysql.typed_results = false


Thank you for the kind sharing from:

http://bryanapperson.com/blog/intro-hhvm-mariadb-nginx-wordpress/
http://bryanapperson.com/blog/install-hhvm-nginx-ubuntu-14-04-make-wordpress-fly/
http://wiki.nginx.org/Install#Official_Debian.2FUbuntu_packages
https://udinra.com/blog/hhvm-fastcgi-nginx-speedup-php
http://stackoverflow.com/questions/23872439/nginx-rewrite-with-laravel-and-hhvm

Monday, September 22, 2014

Fix HHVM 3.3 Bad Gateway error Debian Ubuntu

Found HHVM upgrade to 3.3 on Ubuntu Server 14.04 LTS:

Current status: 2 updates [+2], 33 new [+2].

The following packages will be upgraded:
hhvm linux-firmware
2 packages upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 31.7 MB of archives. After unpacking 11.3 kB will be used.
Do you want to continue? [Y/n/?] y
Get: 1 http://ca.archive.ubuntu.com/ubuntu/ trusty-updates/main linux-firmware all 1.127.6 [20.1 MB]
Get: 2 http://dl.hhvm.com/ubuntu/ trusty/main hhvm amd64 3.3.0~trusty [11.6 MB]
Fetched 31.7 MB in 9s (3,221 kB/s)
(Reading database ... 57804 files and directories currently installed.)
Preparing to unpack .../hhvm_3.3.0~trusty_amd64.deb ...
********************************************************************
* HHVM is being removed. You can remove it from your webserver with:
*
* $ sudo /usr/share/hhvm/uninstall_fastcgi.sh
* $ sudo /etc/init.d/nginx restart
* $ sudo /etc/init.d/apache restart
********************************************************************
Unpacking hhvm (3.3.0~trusty) over (3.2.0~trusty) ...
Preparing to unpack .../linux-firmware_1.127.6_all.deb ...
Unpacking linux-firmware (1.127.6) over (1.127.5) ...
Processing triggers for ureadahead (0.100.0-16) ...
Setting up hhvm (3.3.0~trusty) ...
update-alternatives: using /usr/bin/hhvm to provide /usr/bin/php (php) in auto mode
********************************************************************
* HHVM is installed.
*
* Running PHP web scripts with HHVM is done by having your webserver talk to HHVM
* over FastCGI. Install nginx or Apache, and then:
* $ sudo /usr/share/hhvm/install_fastcgi.sh
* $ sudo /etc/init.d/hhvm restart
* (if using nginx) $ sudo /etc/init.d/nginx restart
* (if using apache) $ sudo /etc/init.d/apache restart
*
* Detailed FastCGI directions are online at:
* https://github.com/facebook/hhvm/wiki/FastCGI
*
* If you're using HHVM to run web scripts, you probably want it to start at boot:
* $ sudo update-rc.d hhvm defaults
*
* Running command-line scripts with HHVM requires no special setup:
* $ hhvm whatever.php
*
* You can use HHVM for /usr/bin/php even if you have php-cli installed:
* $ sudo /usr/bin/update-alternatives --install /usr/bin/php php /usr/bin/hhvm 60
********************************************************************


The web server shows: Bad Gateway.

Try restart HHVM:

# service hhvm restart
* Restarting HHVM FastCGI Daemon hhvm
/usr/bin/hhvm: error while loading shared libraries: libgmp.so.10: cannot open shared object file: No such file or directory


Install libgmp10 package, restart HHVM solve the problem:

# aptitude install libgmp10
The following NEW packages will be installed:
libgmp10
0 packages upgraded, 1 newly installed, 0 to remove and 0 not upgraded.

# service hhvm restart
* Restarting HHVM FastCGI Daemon hhvm

Friday, July 11, 2014

Adobe Reader 9.5.5 license Agreement Linux

Try to install the Adobe Reader 9.5.5 in Ubuntu

Found the License Agreement always popup.

The file location is:
~/.adobe/Acrobat/9.0/Preferences/reader_prefs

Make sure you have the right to it.

Tuesday, April 8, 2014

Clean up Debian Wheezy Ubuntu Server

The Debian 7 Wheezy basic Install is pretty clean.

But still some package can be removed after installation.

Same in Ubuntu many packages can be removed.

First remove the ispell and dictionary

dpkg --purge dictionaries-common iamerican ibritish ienglish-common ispell wamerican


Then remove DHCP client if using static IP:

dpkg --purge isc-dhcp-client isc-dhcp-common


And few other package as option:

dpkg --purge laptop-detect
dpkg --purge xauth


ACPI can be remove if you like:

dpkg --purge acpi acpi-support-base acpid



dpkg --purge wireless-tools wpasupplicant
dpkg --purge nano
dpkg --purge ntfs-3g
dpkg --purge ppp pppconfig pppoeconf