Showing posts with label RHEL. Show all posts
Showing posts with label RHEL. Show all posts

Wednesday, July 8, 2020

How to Rebuild Apache httpd to Change suexec AP_DOC_ROOT from /var/www to /home (CentOS & RHEL)

Standard RPM packages of Apache httpd in CentOS and RHEL compile suexec with a hardcoded document root of /var/www (--with-suexec-docroot=/var/www). However, web control panels like Virtualmin host customer accounts under /home. When suexec executes a user script under /home, it aborts with "command not in docroot". Here is how to rebuild the official upstream httpd SRPM with AP_DOC_ROOT set to /home.

Compilation Flag: --with-suexec-docroot=/home

Rebuilding the RPM

# 1. Install build tools and dependencies
yum install rpm-build redhat-rpm-config gcc make -y
yum-builddep httpd -y

# 2. Download and unpack httpd SRPM
mkdir -p ~/rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS}
cd ~/rpmbuild/SRPMS
yumdownloader --source httpd
rpm -ivh httpd-*.src.rpm

# 3. Edit SPECS/httpd.spec and modify suexec docroot
cd ~/rpmbuild/SPECS
sed -i 's|--with-suexec-docroot=/var/www|--with-suexec-docroot=/home|g' httpd.spec

# 4. Rebuild binary RPM
rpmbuild -bb httpd.spec

# 5. Install the custom suexec binary
rpm -Uvh --force ~/rpmbuild/RPMS/x86_64/httpd-*.rpm

Confirm the new docroot:

suexec -V | grep AP_DOC_ROOT

Wednesday, January 6, 2016

How to Install and Use zerofree on CentOS, RHEL, and Fedora to Compact VM Disks

When shrinking dynamic virtual machine disk images (such as VirtualBox VDI, VMware VMDK, or QEMU QCOW2), zeroing out unused filesystem blocks is essential for effective host compression. Because Enterprise Linux distributions (CentOS 6/7, RHEL) do not ship zerofree in their default package repositories, compiling from source is the quickest solution.

Environment: CentOS 6/7 • RHEL • Fedora • Ext3 / Ext4 Filesystems

1. Installing Build Headers and Compiling zerofree

Install the e2fsprogs development headers and compile:

yum install e2fsprogs-devel gcc make -y
cd /usr/src
wget http://frippery.org/uml/zerofree-1.0.3.tgz
tar -zxf zerofree-1.0.3.tgz
cd zerofree-1.0.3
make
cp zerofree /usr/bin/

2. Zeroing Out Unallocated Blocks

Important: Always remount the target filesystem in read-only mode prior to executing zerofree to prevent filesystem corruption:

# Remount filesystem as read-only:
mount -o remount,ro /

# Run zerofree on the target block partition:
zerofree -v /dev/sda1

Once complete, shut down the VM and run your hypervisor's disk compacting command (e.g. VBoxManage modifymedium --compact disk.vdi) on the host machine.

Friday, December 14, 2012

How to Install Wine with MS Visual C++ and Visual Basic Runtimes on Linux

Running specialized Windows desktop utilities (such as download managers like Orbit Downloader, HiDownload, or Net Transport) on Linux often requires essential Microsoft Visual C++ and Visual Basic runtime libraries that are not packaged by default in vanilla Wine.

Prerequisites: Wine installed via EPEL (CentOS / RHEL) or standard distribution repositories (Ubuntu / Debian).

Step-by-Step Installation

1. Install Cabextract

The cabextract utility is required by Winetricks to unpack Microsoft cabinet files:

# On Debian / Ubuntu:
sudo apt-get install cabextract -y

# On CentOS / RHEL (requires EPEL):
sudo yum install cabextract -y

2. Download and Run Winetricks

Fetch the official winetricks script and install the required core fonts, Visual C++ 6.0, and Visual Basic 6.0 runtimes:

wget https://raw.githubusercontent.com/Winetricks/winetricks/master/src/winetricks
chmod +x winetricks

sh winetricks corefonts vcrun6 vb6run

Once the runtime components are installed into your ~/.wine prefix, your Windows applications will initialize without missing DLL or runtime errors.

How Google Antigravity Solved the Mysterious NVIDIA Sleep Reboot on My Dell Inspiron 7567 (Ubuntu Linux)

If you run modern Ubuntu or Linux on a Dell Inspiron 15 Gaming (7567) or a similar 7th-gen Intel laptop paired with an NVIDIA GeForce GTX ...