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

Sunday, February 09, 2025

Pihole & Docker FTW!

I'd been planning to mess with Pihole but didn't want to mess with a Rasberry Pi.  I did some research and found that I'd the option to install Pihole on a running Linux system.  While looking at what that entailed, I also found that I could easily do it with Docker, too.

I've been running a Ubuntu system for a while now.  It is mainly a box I set up for use with NextCloud.  I hate NextCloud and stopped using it and the Ubuntu system.  The system was pretty much idle until I decided to set up a Wordpress instance in Docker for development of my Wordpress site that's on my Linode instance.  Whenever I'm trying something new in Wordpress, I test it on my Dockerized Wordpress instance first.  Eventually I'll work on replacing the Wordpress instance on my Linode host with a Dockerized instance.

Since I already have Docker set up on the Ubuntu box, I decided to give Pihole a spin in Docker.

I used this website to set up Pihole in Docker.  The whole setup was quick and painless.  In fact, my Wordpress setup uses three different Docker containers, and with Pihole now running, I'm now using four containers on that Ubuntu host.  None of them are consuming resources (thus far).

I'm now testing Pihole.  I'm totally unfamiliar with it but it doesn't appear to be a high maintenance setup.  At some point, I'll want to back up the Pihole configs, though, so I won't have to spend a lot of time setting it up again (when/if I end up blowing away the instance).

I've several hosts on my LAN using the Pihole setup and my daughter is trying it, as well.  She had a Rasberry Pi and was planning ot install Pihole on it, but I told her that this is far simpler - she should use the Pi for something else, IMO.

I've added some ad lists (block lists and some whitelisting), as well.

The biggest pain as far as adware goes is Youtube, and I don't think Pihole is going to be able to block Youtube ads when using the Youtube app.  I've had some luck blocking Youtube ads on my Macbook, but I view videos on the browser when using that notebook (and I've the uBlock Origin browser extension installed in MS Edge).

Wednesday, June 19, 2024

Docker, Wordpress, and Linode

Maybe a week ago, I decided to refresh my Linode instance.  I'd been using Ubuntu 16.04 LTS on it the past 10 years.  16.04 has been unsupported for quite a while now, but I was being lazy while still watching the server for possible compromises (the server was locked down very well).

Initially, I'd planned on a slow rollover to Ubuntu 24.04 LTS, by deploying a new host and slowly migrating over to it from the old server.  One day, I just said, "fuck it" and started from scratch.  I kept my old disk volume and mounted it to the new host so that I could grab old data whenever I needed it...having config files from the old host would help me when reinstalling the software I was using on the old host.

The plan was to migrate my two Wordpress sites to the new host but today I tried running Wordpress on Docker on an old Dell XPS 8930 and it worked well.  I first tried to just get to the point where Wordpress could install onto it.  I then tried to restore a backup of one Wordpress site onto the Dockerized Wordpress instance and I was immediately successful.  It happened so quickly that I spent the rest of the day testing it, to the point that I decided to do the same thing on the 24.04 server tonight.  It's now up and running and I've already been posting to it.  I'll monitor it the next few days and will probably back it up, tear down the whole thing, and then try some different setups, such as trying to run both Wordpress sites from one set of containers (the problem is, I need both Wordpress sites to be serving on port 80 and there's only one port 80 on the server.

Currently the setup is using three small containers (one for MySQL, one for Wordpress, and one for phpmyadmin).  I leveraged the YAML files of two other nerds, using both to build my own YAML file, which I used to pull the images and configure the containers.  I ran in to issues more than a few times, but between what I learned last year on acloud.guru and trial and error, it wasn't all that difficult.  What I haven't done (YET) is build my own dockerfiles.

I usually also use the Linode host as a file server (sharing pictures with friends and forums), and I was doing that using Apache, so that's a 3rd application that I'd need to use port 80...not sure how I'm going to set all this up, but the neat thing about Docker is that I can blow it away and start over (keeping my .yml compose files to work with and tweak), again and again, until I get it right.

This was the first time outside of training that I used Docker and I honestly should've been using it a long time ago.

I actually had a lot of fun doing this.

UPDATE (7/28/2024):

I'm having some issues trying to determine how to host two sites on one Dockerized Wordpress setup.  I can probably use the muti-site Wordpress setup but I need to study up on how to alter the wp-config file using the docker-compose.yml file.

Or, I can probably just run two Docker setups, one for my firearms blog and one for my car blog.

I also want to be able to share my many pictures and files using Apache, but found that I can't run Apache AND Worpdress, as both use port 80.  I may have to use some type of proxying.

Lastly, I can just reinstalled Wordpress in a non-Dockerized fashion, while experimenting with Wordpress in Docker.  This is probably the more reasonable approach, as I can study up how to leverage Docker at my own leisure but have a production native Wordpress setup.

Thursday, May 26, 2022

Ubuntu Desktop 22.04 and Dell XPS 8930

2-3 years ago, I bought my daughter a Dell XPS 8930.  It was nothing special but was a good base in case she needed to expand the system a bit.

Not long after purchase, the motherboard went bad.  I had on-site support for it but never got around to getting it repaired until maybe a month before support expired.  A contractor showed up and replaced the mainboard. 

My daughter only used it a few months then decided to build her own.  The XPS was sitting in a corner, barely used.

I've a cheap system I bought from TigerDirect that is running Ubuntu.  It is currently running Ubuntu Desktop 18.04.  I'd installed Owncloud on it, but the install got jacked up.  it's all out of sync now, package-wise.  I'd attempted to update Owncloud and it choked.  I've not been able to get it running again and it has crucial data on it (it has two drives and the Owncloud data is on the 2nd non-system drive).

I decide to run Ubuntu Desktop 22.04 on the XPS.  I'd initially installed LTS 22.04 but at this time that version has issues with systems that have Nvidia cards and I didn't want a headless system (I already have several of those), so I opted for Desktop.  The Desktop install was seamless.

Desktop 22.04 already has a cloud-based system included in the default install - Nextcloud.  I'm still playing with it but I'll more than likely use that since it's within the Ubuntu repository (Owncloud wasn't when I last checked).

Some things I don't like about these latest Ubuntu versions (noticed this will LTS as well):

  • vim wasn't installed by default.  vi is installed by default.  I think this is a licensing thing (I don't believe vim is POSIX).  As well, if vi is already installed, I guess vim wouldn't need to be.  If anyone needs vim, they can use apt to install it post-install.
  • ifconfig was not installed by default.  IMO, ifconfig should be essential to a default install.  You might need to troubleshoot a network issue immediately after installing the distro and if you don't have a network connection, you're screwed.  ifconfig is included in the net-tools package.  That package shouldn't be excluded from the base install.

Everything else seems to be good with this distro version, but I'm sure I'll find something amiss as I use the system.

Tuesday, September 30, 2014

Wordpress Woes

I did a dumb thing last week.

I'd been holding back on upgrading my Ubuntu server to 14.04...for good reason:  I was running software versions that weren't compatible with my version of Ubuntu.

Well, I upgraded anyways (after months of holding off).  It broke my web server and also reverted my Wordpress site back a few versions (3.8.x or something like that...I'd been running version 4.0).

That was this past Saturday.  Today is Tuesday afternoon and I'm almost finished restoring the site.

Things that broke:

Wordpress
PSAD
Apache

I'm going to specifically speak to Wordpress now.

This was actually an Apache/Wordpress combination issue.  I believe the version that Apache was upgraded to was 2.4.x.  It changed the default webserver location from /var/www to /var/www/html, which broke a LOT of my content.  The fix was easy:  I moved everything from /var/www to /var/www/html, ensuring the file and directory permissions didn't change.

Then, I found a multitude of issues with my Wordpress site's content:


  1. All image links broke, meaning they wouldn't render, even after moving content to /var/www/html (but I could upload new pictures without issue -- and they'd render).
  2. I couldn't perform upgrades to v4.0 via the GUI.
  3. I couldn't install new plugins.
  4. I couldn't install templates.


First thing I did was upgrade (manually, via CLI) to v4.0.  That cleared up some issues.

Next, I worked on trying to get the plugins to work.  I couldn't install new plugins.  I also couldn't update old plugins to new versions.  The error I would get was, "Unable to locate Wordpress content directory".  I'd also get "Unable to locate Wordpress plugin directory".  What I did was download (via web browser) the "third party host fix" plugin.  I loaded it to my Ubuntu server via SCP.  I then unzipped it, and moved the uncompressed directory to the plugins folder.  It still wouldn't work.  I found that a symlink was missing from /var/lib/wordpress/wp-content/plugins, so I created a new one:

lrwxrwxrwx 1 root root 60 Sep 30 19:48 third-party-host-fix -> /usr/share/wordpress/wp-content/plugins/third-party-host-fix

That's linked to /usr/share/wordpress/wp-content/plugins/third-party-host-fix...that also the directory where the actual plugin content is located.

After I did that, I was able to see the plugin in the UI.  I activated it successfully.  I then tried to update a plugin...I got a different error:  "Wordpress could not create directory".  Ugh...

I found the solution on how to fix that issue at https://help.ubuntu.com/community/WordPress.  I went to /usr/share/wordpress/wp-config.php and edited the following:

Changed:

define('WP_CONTENT_DIR', '/var/lib/wordpress/wp-content');

to read:

define('WP_CONTENT_DIR', '/var/www/wordpress/wp-content');

That fixed the issues of installing or updating templates and plugins.

The only issue I need to resolve now is the image rendering issue, but I think I'll just reload all the images, one at a time (there aren't all that many, I believe).

This was a horrible experience but the benefit was that it got me to delve and fix the issue (vs. just wiping everything and reinstalling the whole distribution).

UPDATE:

New issues --
  1. Can't remove plugins.  Error message:  "Plugin could not be deleted due to an error: Unable to locate WordPress Plugin directory."
  2. Using Photo Gallery plugin - galleries will render but the images will not show within the gallery UI.  I also can't seem to view the images via browser...may be another incorrect coding issue or even a permissions issue.
UPDATE 2:

  1. I've fixed the issue with the Photo Gallery plugin.  I basically dumped the picture back in the directory where the plugin was looking for them (/usr/share/wordpress/wp-content/uploads/photo-gallery).  I hate how hodge-podge this is...crap is everywhere without standardization, but I'm to the point where I just want the site functional again.  I just hope things don't break when I next upgrade Wordpress.
  2. I'll look into the "can't remove plugins" issue tomorrow.