• Skip to main content

Uly.me

cloud engineer

  • Home
  • About
  • Archives

Archives for November 2016

WordPress on Docker

November 28, 2016

WordPress is a content management system for running blogs or websites. Meanwhile, Docker is a software container platform for building, shipping and running applications or utilities. Since there are thousands of Docker images already built, installing an application such as WordPress is fairly easy. In this article, I will show you how to install WordPress, MySQL, PHPMyadmin in a Docker environment. First things first, install Docker. Docker is agnostic, meaning it really doesn’t matter what platform you use, whether you’re on Windows, Linux or the Mac. Download Docker Docker. Install.

Create A Project Folder

$ mkdir wordpress
$ cd wordpress

$ mkdir wordpress $ cd wordpress

Create a Docker Compose file

The docker file for composing an image is called docker-compose.yml. It’s a YAML file that contains instructions on what to do and apps to use.

$ nano docker-compose.yml

$ nano docker-compose.yml

Type in the following configuration in the YAML file. In this example, I’m telling docker to install WordPress, MySQL and PHPMyAdmin and using the following TCP ports, credentials, and volumes.

wordpress:
  image: wordpress
  links:
    - wordpress_db:mysql
  ports:
    - 8080:80
  volumes:
    - ~/Docker/wordpress/html:/var/www/html
wordpress_db:
  image: mariadb
  environment:
    MYSQL_ROOT_PASSWORD: password
phpmyadmin:
  image: corbinu/docker-phpmyadmin
  links:
    - wordpress_db:mysql
  ports:
    - 8181:80
  environment:
    MYSQL_USERNAME: root
    MYSQL_ROOT_PASSWORD: password

wordpress: image: wordpress links: - wordpress_db:mysql ports: - 8080:80 volumes: - ~/Docker/wordpress/html:/var/www/html wordpress_db: image: mariadb environment: MYSQL_ROOT_PASSWORD: password phpmyadmin: image: corbinu/docker-phpmyadmin links: - wordpress_db:mysql ports: - 8181:80 environment: MYSQL_USERNAME: root MYSQL_ROOT_PASSWORD: password

Run Docker Compose

$ docker-compose up -d

$ docker-compose up -d

The installation may take anywhere from 5-10 mins or longer. So, grab a cup of coffee.

Access WordPress

Once installed, open up your browser and access WordPress and PHPMyadmin

http://localhost:8080
http://localhost:8181

http://localhost:8080 http://localhost:8181

You can access the WordPress files from your project’s “wordpress/html” directory.

wp-docker

That’s it.

Filed Under: Linux, Mac, PHP, WP Tagged With: docker, phpmyadmin, wordpress

Missing add-apt-repository command

November 13, 2016

When adding a new repository in Ubuntu, you can go the PPA route by using the add-apt-repository command. If you’re getting a missing add-apt-repository command, it’s probably not installed. You need to install the “software-properties-common” and “python-software-properties” packages from the Terminal. By the way, if you’re curious, PPA means personal package archive. PPAs are repositories hosted on Launchpad which you can use to install or upgrade packages that are not available in the official Ubuntu repositories. Just think of them as extended repositories.

If you’re getting a missing add-apt-repository command, just install the following:

$ sudo apt-get install software-properties-common python-software-properties

$ sudo apt-get install software-properties-common python-software-properties

Once installed, you can then add other repositories that you want.

Let’s say you want to install Sublime Text 2, a real popular text editor.

You can install Sublime Text 2 via the PPA route using the following.

$ sudo add-apt-repository ppa:webupd8team/sublime-text-2
$ sudo apt-get update
$ sudo apt-get install sublime-text-2

$ sudo add-apt-repository ppa:webupd8team/sublime-text-2 $ sudo apt-get update $ sudo apt-get install sublime-text-2

Or install the latest Gimp release:

sudo add-apt-repository ppa:otto-kesselgulasch/gimp
sudo apt-get update
sudo apt-get install gimp

sudo add-apt-repository ppa:otto-kesselgulasch/gimp sudo apt-get update sudo apt-get install gimp

To revert the changes:

sudo apt-get install ppa-purge
sudo ppa-purge ppa:otto-kesselgulasch/gimp

sudo apt-get install ppa-purge sudo ppa-purge ppa:otto-kesselgulasch/gimp

Filed Under: Linux Tagged With: apt-get, install, ppa

Check Open Ports

November 9, 2016

If you’re running a Linux server, here’s one way of checking as to which ports are open to the public. You can use netstat for that purpose. Netstat is a command-line network utility tool that displays network connections for tcp, routing tables, and a number of network interfaces. It’s available on Linux, MacOS and Windows.

In Linux and MacOS, type the following via the Terminal.

netstat -tupln
#
# -l = only services which are listening on some port
# -n = show port number, don't try to resolve the service name
# -t = tcp ports
# -u = udp ports
# -p = name of the program
#

netstat -tupln # # -l = only services which are listening on some port # -n = show port number, don't try to resolve the service name # -t = tcp ports # -u = udp ports # -p = name of the program #

If you’re in Windows, open up Powershell and type in:

netstat -ano | find "LISTENING"
# or
netstat -o 5

netstat -ano | find "LISTENING" # or netstat -o 5

Don’t be surprised as to what your computer is doing.

Filed Under: Linux, Mac Tagged With: netstat, open ports

Can’t Empty The Trash Can

November 9, 2016

If you have trouble emptying the trash this morning, here’s a helpful tip.

Your OS is essentially telling you the file is in use, but the application is close.

Nothing like running rm -rf on the trash folder.

# Go the trash directory and delete all!
cd ~/.Trash
rm -rf *

# Go the trash directory and delete all! cd ~/.Trash rm -rf *

The file is gone!

Filed Under: Linux, Mac Tagged With: app in use, rm -rf, terminal, trash

Optimize Your Videos For The Web

November 6, 2016

If you have a video that you would like to share with others, how do you optimize it for the web. I’m using a simple open-source program called Handbrake which you can download for free. It’s available from handbrake.fr. Handbrake is available on Windows, Mac and Linux. Based on my experience with working with Handbrake, I was able to shrink my videos to less than 10% of the original size without sacrificing quality.

Here’s a short video of how to optimize your videos for the web using Handbrake.

Video

Filed Under: Misc Tagged With: encoding, handbrake, optimize, video

Implementing Surfcali.com

November 6, 2016

I have a website called Surfcali.com. It’s a website that provides tide table information for select California beaches. The tide information on the website is auto-generated by the xtide program which is available on most Linux distributions.

You can install xtide on Ubuntu by typing this command from the Terminal.

sudo apt-get install xtide

sudo apt-get install xtide

Instead of explaining how the website is implemented using lots of words, it’s probably much easier to explain it via video.

So, here’s a short video of how Surfcali.com was put together.

Video

Filed Under: CSS, HTML, PHP Tagged With: bash, cron, surfcali.com, tide table, xtide

  • Home
  • About
  • Archives

Copyright © 2023