APACHE – permanent redirect to another server & port

I’m using CentOS 7.2 & the corresponding layout as seen here.

So, I have a few VMs that host sites and I elected *not* to move on with AWS due to my very strained budget and it’s using Ubuntu and docker.
That being said, I kept an Ubuntu VM and it can’t share port 80 due to just a single Internet connection inbound and I was forced to make changes.

Here’s what I did to get around it (mind you, none of this is actual):

Take your /etc/httpd/sites-enabled file and make some additions:

# cat blog-toloughlin.conf

ServerName blog.toloughlin.com
ServerAlias blog.toloughlin.com
RedirectPermanent / http://www.blog.toloughlin.com:81
# optionally add an AccessLog directive for
# logging the requests and do some statistics

Next time you visit that domain, it’ll push the traffic back to port 81 (translated by your router).

Caveat: you’ll see :81 in your URL bar and some of your site may not work correctly (things coded to use the domain & no port numbers).

It’s hackey, but it works … fairly well.

corrupted or tampered with during downloading ???

Well, I guess it’s common now to see this when trying to install OS X. My example happened when I tried to install El Capitan, fresh (no upgrade) on a newly formatted SSD – and had me scratching my bean.

I got this:
This copy of the Install OS X El Capitan application can't be verified. It may have been corrupted or tampered with during downloading

People have identified the need to set the clock back via Terminal, right before you install the OS after boot-up.

I checked my time & it was spot on (although it thought I was on the Left Coast, which I’m not).

I COULD have ran the infamous date command (date MMDDHHmmYY), but elected not to.

I deleted the installer and downloaded El Capitan yet again. Guess what? It worked.

Here is what I’m thinking. If you download & set it aside for a while, you need to roll your clock back. If not, you’re good to go.

So if you don’t have the luxury of downloading the OS again, see what the time/date stamp shows up as and set the date back to a week later than that and you should be all set.

So, if you see this (for example):

But it’s April, 2016 now … run:
date 0401101016

Exit the Terminal App and try the install again.

MOSH – when you need to SSH and there’s intermittent connectivity problems

Read about is here: https://mosh.mit.edu/

I loaded it up on RHEL 7.2, and here’s the process that I went through …

Add pre-requisite packages:
yum -y install git protobuf-c autoconf automake wget bzip2 gcc-c++ zlib-devel libutempter ncurses-devel openssl-devel net-tools

Run all of these commands:

wget http://protobuf.googlecode.com/files/protobuf-2.4.1.tar.bz2
tar -xf protobuf-2.4.1.tar.bz2
cd protobuf-2.4.1
./configure --prefix=$PREFIX
make install

export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/root/lib/pkgconfig

$ git clone https://github.com/mobile-shell/mosh
$ cd mosh
$ ./autogen.sh
$ ./configure
$ make
# make install

echo "export LD_LIBRARY_PATH=/root/lib" >> ~/.bashrc ; source ~/.bashrc

firewall-cmd --add-port=60000-61000/udp

Have you heard that RHEL is available ‘free’ for your Development Environment?

It sure is – woo hoo!

Dance on over to https://developer.redhat.com, sign up and accept their terms.

You can then download the latest ISO (7.2 at the time of this writing) and load it up on a server or VM. Make sure you select “Developer Tools” during the installation.

If you selected Basic (no GUI), you’ll need to run a few extra steps after installing, in order to get your yum updates.

# subscription-manager register
Registering to: subscription.rhn.redhat.com:443/subscription
Username: your new shiny name
The system has been registered with ID: XXXXXXXX

# subscription-manager attach
Installed Product Current Status:
Product Name: Red Hat Enterprise Linux Server
Status: Subscribed

# subscription-manager repos --enable rhel-server-rhscl-7-rpms
# subscription-manager repos --enable rhel-7-server-optional-rpms
# subscription-manager repos --enable=rhel-7-server-extras-rpms

Now don’t be a jerk and try to use it in production; all it takes is one support call and accidentally outing yourself to cause your entire company to be forced to conduct a licensing audit.  That won’t be fun. 

firewalld – allowing individual host access

So, you’re rolling out a new webserver and want only certain people to take a look at the content? Here’s how you do it.
CentOS 7.2 is the OS being used.

What zone are you in?
[root@blog-test ~]# firewall-cmd --get-default-zone

OK, let’s make a new zone:

firewall-cmd --permanent --new-zone=blog
systemctl reload firewalld

Now, let’s add your IP & a friends IP to start testing … given you’re using apache & it’s still on port 80:

firewall-cmd --permanent --zone=blog --add-source=YOUR_IP/32
firewall-cmd --permanent --zone=blog --add-source=FRIENDS_IP/32
firewall-cmd --permanent --zone=blog --add-port=80/tcp

NOTE:  If you are using that port in another zone, remove it from that other zone first, because it can’t be in 2 zones at once.

That’s all there is. Move along now.


Windows 7 – Can’t Check for Updates

So, I booted up a Win7 VM that hasn’t been online in 11 months — Windows Update won’t work!

Microsoft was nice enough to give me this message:

Windows Update Cannot Check For Updates, Because The Service Is Not Running

I tried letting Microsoft “fix it for me” from this page, but it didn’t work:

Here’s the fix.

Start -> type cmd
Right-click on cmd and click on: Run as administrator
Type the following lines, hitting enter after each one:

net stop wuauserv
cd %systemroot%
ren SoftwareDistribution SoftwareDistribution.bad
net start wuauserv

Launch Windows Update again – and — let the updates begin!

Where I write things down, so I don't have to Google it later