Resurrection Remix Pie for the XA2 Ultra!

To God be the glory, I finally finished a XA2 Ultra build of Resurrection Remix! It’s Resurrection Remix, Pie flavored! You can check it out on XDA if you would like, but here is my post from there:

Here’s a quote from RR:

We work to make your android experience elegant. Handpicked features beautifully packed into one ROM.

**** This is an UNOFFICIAL ROM. Install at your own risk! ****

A huge thanks to the Resurrection Remix team! Another huge thanks goes out to XDA developer LuK1337 for all of the great development that he did on the Sony Xperia XA2 Ultra! He did most of the heavy lifting by making a great LineageOS build, upon which this RR is based. Please note, this is an UNOFFICIAL ROM.

Disclaimer: Resurrection Remix is not responsible for any damages to your device.
All of my work is completely available for any who wish to use or modify it. I didn’t make Resurrection Remix, the device trees, or vendor blobs. I simply used and edited existing material. A huge thanks should go to those who actually created this stuff.

This Unofficial Resurrection Remix Pie ROM was built for H3223 (discovery), but may work on some of the other variants, please try at your own risk. However, if you do try it on another variant, please be sure to let me know in the comments how it worked.

Downloads:
Rom Download link:
WARNING: This is only for those on firmware versions 50.1.xxxxxx, not for those who are on firmware versions 50.2.xxxx and up. I plan on working on updated firmware versions later.
http://www.mediafire.com/folder/6ni8bw8ansajf/pie
There is an ENGINEERING and USERDEBUG build. The ENG build is marked “ENG” for testing purposes only. You can install anything you want, but I recommend not installing the ENG build.

Gapps link:
[url]http://opengapps.org/[/url]
If desired. Personally, I’ve gone Gapp-less.

Installation instructions:
-Download ROM and gapps, and put them on your removable sdcard storage. (Or leave on your computer and flash with adb sideload.)
-Reboot into the bootloader.
-Fastboot boot your TWRP.
-Backup what you had. (Just to be safe.)
-Wipe everything and format data.
-Install Rom. (Either from adb sideload or from your removable sdcard storage.)
-Reboot to system and enjoy!
If you also want Gapps:
-Reboot again into the bootloader.
-Fastboot boot your TWRP.
-Install Gapps. – Optional
If you plan to install magisk (good idea), then let the rom boot the first time, then go back to TWRP and flash magisk. This is optional, of course.

What works:

So far everything that I have tried works, such as

Camera for pictures and video, Phone calls, Data 3g/LTE, Bluetooth, WiFi, MTP, etc….

What doesn’t: Nothing that I know of, but if you find something, please let me know so we can try to fix it!

Source Code:
https://github.com/ResurrectionRemix
Official website:
http://www.resurrectionremix.com/
My device trees, vendor blobs, and kernel source:
https://gitlab.com/alaskalinuxuser

ROM OS Version: 9.0 Pie
RR version: 7.0.2
ROM Kernel: Linux 4.4.153
Based On: The best of every ROM, but particularly based on LineageOS.

Created 2019-08-16

Linux – keep it simple

 

Advertisements

Engineering Pie Build for the Sony Xperia XA2 Ultra!

So it’s been a rough start for me, stepping into the modern world with a modern phone that has a/b partitioning and was Android 8.0+. I’ve built dozens of roms for dozens of phones, some that were even unsupported, and to God be the glory, I was moderately successful, but these modern phones have been a different story. My first attempt with the Xperia XA2 Ultra ended up hard bricked. Then, I built a pie version of AOKP, which did boot, but would immediately crash after getting to the home screen.

Today, however, was off to a much better start. I successfully tested my engineering build of LineageOS 16.0 (pie) for my XA2 Ultra (discovery). Everything seems to work well, and you are welcome to try it out. Keep in mind, though, it is an engineering build as opposed to a user build. Also note that this is for the 50.1.x firmware variants.

Granted, a lineage build is already available, and most of the work was done by Luke. I like to compile a build on my own, though, to make sure my system is set up properly and that the source material does work before I get started on my own roms.

Now to get back to that AOKP build…. Or should I start on a Resurrection Remix build instead?

Linux – keep it simple.

Still using AsteroidOS and loving it!

image

A while back I switched my LG Watch Urbane (bass) from Android Wear to AsteroidOS. My initial reaction was really positive, but I wanted to come back to post later on how the long term use was going. Truth is, it’s great!

image

Don’t get me wrong, Android Wear had some nice features, a few of which I still miss. Most notably the one where the motion of turning your watch towards your face caused the screen to turn on.

image

But other than that, AsteroidOS has met every need I have in a smart watch. Most notably that of telling time and the synchronized phone notification. Of course the weather and calendar apps are handy too. When it really comes down to it, I realized that I didn’t use Androids thousands of apps on my watch because the screen is too small. Why would anyone watch an HD movie on a 1.5″ screen?

AsteroidOS has really been great at having useful apps that one would actually want to use on the small screen, which just makes sense. I’ve also gone weeks or more without rebooting the watch. The firmware is really robust and never seems to have an issue.

The best part of all? The battery life is phenomenal! Since switching, I went from about 9 or 10 hours with Android Wear to 2 days with AsteroidOS. And that’s a win win for me!

Linux – keep it simple.

Fixing a Galaxy Note 9 with broken glass

image
Well, at least attempting to. Unfortunately it didn’t end very well. A friend of mine broke the glass screen of their Samsung Galaxy Note 9. They have a warranty on it, but they already broke the screen once, and now they would have to pay several hundred dollars to have this one fixed again.

Remember: Glass screen protectors are your friend! A case doesn’t protect the screen! Always buy a glass screen protector!

They bought a replacement glass kit for around $30 and hoped to do the work themselves and save a lot of money. Once they started watching how to videos, though, they realized that they were in over their heads. So, they came to me…..

Of course, my first suggestion was that they seek a professional. Turns out the only professional in our town wanted $300 to do the work. Unfortunately for my friend, that was still too much. So, they asked me to give it a try first.

I told them this wouldn’t work. I don’t have the right equipment. I don’t have a warranty. I could ruin the screen. But, they were persistent, so I gave it a go.

The key is to get the glass hot, but not hot enough to melt the screen. So I used a heat gun and a thermometer to adjust it to 90 degrees Celsius. Once that was set I started heating the glass.

Then, using a toothbrush, I started applying isopropyl alcohol to the shattered portion of the screen. This breaks down the glue. As carefully as I could I used plastic screwdriver type tools to lift off the broken chunks of glass.

All was going really well for the first 30 minutes. I had lifted off the glass in about the shape and size of a quarter, and was moving right along. And then… while lifting a longer piece of glass, it levered against the screen, and poked the digitizer, causing a huge green line and purple line right down the middle of the display!
image
I was really bummed! Now the screen and the glass were ruined, and, despite the warnings I gave my friend beforehand, I’m pretty sure that they lost all confidence in my phone skills. They ended up turning it in for repair.

So, the moral of the story is: buy a good glass screen protector, and don’t try to fix broken glass without the right tools.

Linux – keep it simple.

3D Printer Supports, Anyone?

I’ve been having a great time with the 3D printer. It’s a bit tedious to constantly adjust every setting to tweak things into a better print, but it really is a fun hobby! Lately, I’ve been working on the supports. For those who are new (like me) to 3D printing, supports are used to, well, support the 3D object while it is being printed. Below you can see the chess knights that I just printed. The broken pieces in between them are the supports I took off, that were used to hold the snout while it was being printed.

IMG_20190730_162910

Here is a picture with them in place:

IMG_20190730_162743

What can be interesting, is when your supports really are not needed, but get built anyways. Take for example, this king and queen chess set, where originally it wanted to build supports, but I opted not to, and it fared well without them.

IMG_20190730_042032

The slicer program (slic3r) wanted to put supports in between the “arms” of the pieces to hold them up during printing. But it seems to have printed fine without them. Another interesting problem was this spiral pawn chess piece (incomplete). I stopped it while printing because I realized that I couldn’t take the supports out of the spiral.

IMG_20190730_042015

So I’m still tinkering with supports, when to use them, when not to use them, how to use them better, etc. It’s pretty interesting to mull over, and hopefully I can come up with some sort of “truth table” on when and how to use them. The general rule is that a “Y” shape is okay, and a “T” shape is not. This spiral set is more or less “T” shaped, but having the supports inside that are impossible to remove sort of defeats the purpose of the spiral set….. I guess I will have to think on it some more.

Linux – keep it simple.

Colido 3D DIY Slic3r Settings

IMG_20190720_091201

As promissed, I wanted to make a post with my slicer settings that I use for my Colido 3D DIY printer in Slic3r. Why? Because I’m learning that slicer settings matter, big time. If the above picture loaded for you, then you can see that the same 3D model will drastically change when sliced with different slice settings. Warping, crummy prints will plague you if you don’t get this right.

I learned this the hard way, and, after dozens of test prints, I finally found something that prints decent for my modest printer. If any of you happen to have a Colido 3D DIY printer, then maybe this can save you dozens of prints spanning days or weeks of free time. At least, that’s the goal.

Here is my colido3Ddiy.ini file:

# generated by Slic3r 1.2.4 on Wed Jul 17 17:27:12 2019
avoid_crossing_perimeters = 0
bed_shape = 0x0,200×0,200×200,0x200
bed_temperature = 0
bottom_solid_layers = 3
bridge_acceleration = 0
bridge_fan_speed = 100
bridge_flow_ratio = 1
bridge_speed = 60
brim_width = 0
complete_objects = 0
cooling = 1
default_acceleration = 0
disable_fan_first_layers = 1
dont_support_bridges = 1
duplicate_distance = 6
end_gcode = M104 S0 ; turn off temperature\nM140 S0 ; set bed target temp\nG28 X0 ; home X axis\nM84 ; disable motors\nG1 Z169 F200;
external_fill_pattern = rectilinear
external_perimeter_extrusion_width = 0.35
external_perimeter_speed = 70%
external_perimeters_first = 0
extra_perimeters = 1
extruder_clearance_height = 20
extruder_clearance_radius = 20
extruder_offset = 0x0
extrusion_axis = E
extrusion_multiplier = 1
extrusion_width = 0.35
fan_always_on = 0
fan_below_layer_time = 60
filament_diameter = 1.75
fill_angle = 45
fill_density = 30%
fill_pattern = line
first_layer_acceleration = 0
first_layer_bed_temperature = 0
first_layer_extrusion_width = 200%
first_layer_height = 0.32
first_layer_speed = 70%
first_layer_temperature = 195
gap_fill_speed = 20
gcode_arcs = 0
gcode_comments = 0
gcode_flavor = reprap
infill_acceleration = 0
infill_every_layers = 1
infill_extruder = 1
infill_extrusion_width = 0.29
infill_first = 0
infill_only_where_needed = 0
infill_speed = 20
interface_shells = 0
layer_gcode =
layer_height = 0.16
max_fan_speed = 100
min_fan_speed = 35
min_print_speed = 10
min_skirt_length = 0
notes =
nozzle_diameter = 0.4
octoprint_apikey =
octoprint_host =
only_retract_when_crossing_perimeters = 1
ooze_prevention = 0
output_filename_format = [input_filename_base].gcode
overhangs = 1
perimeter_acceleration = 0
perimeter_extruder = 1
perimeter_extrusion_width = 0.21
perimeter_speed = 20
perimeters = 3
post_process =
pressure_advance = 0
raft_layers = 0
resolution = 0
retract_before_travel = 2
retract_layer_change = 1
retract_length = 3
retract_length_toolchange = 10
retract_lift = 0
retract_restart_extra = -0.01
retract_restart_extra_toolchange = 0.5
retract_speed = 40
seam_position = nearest
skirt_distance = 6
skirt_height = 1
skirts = 1
slowdown_below_layer_time = 30
small_perimeter_speed = 30
solid_infill_below_area = 70
solid_infill_every_layers = 100
solid_infill_extruder = 1
solid_infill_extrusion_width = 0.59
solid_infill_speed = 60
spiral_vase = 0
standby_temperature_delta = -5
start_gcode = M104 S195 ; set temperature\nG28 ; home all axes\nG1 Z5 F200 ; lift nozzle\nM109 S195 ; wait for temperature to be reached
support_material = 1
support_material_angle = 0
support_material_enforce_layers = 0
support_material_extruder = 1
support_material_extrusion_width = 0
support_material_interface_extruder = 1
support_material_interface_layers = 3
support_material_interface_spacing = 0
support_material_interface_speed = 100%
support_material_pattern = pillars
support_material_spacing = 2.5
support_material_speed = 60
support_material_threshold = 0
temperature = 195
thin_walls = 1
threads = 2
toolchange_gcode =
top_infill_extrusion_width = 0.2
top_solid_infill_speed = 50
top_solid_layers = 3
travel_speed = 130
use_firmware_retraction = 0
use_relative_e_distances = 0
vibration_limit = 0
wipe = 0
xy_size_compensation = 0
use_volumetric_e = 0
z_offset = 0
before_layer_gcode =

So in these 125 settings are the keys to a successful print on my 3D printer. I’d like to point out just a few things about them though:

  • perimeter_speed = 20 ; Going slow on the perimeters really helped define the shape of my prints. It does make it take much longer, since I’ve slowed down all the speeds, but it does make a huge difference on the quality of the finished product.
  • layer_height = 0.16 ; Having a finer layer height also drastically improved the print quality.
  • infill_speed = 20 ; You could probably make this faster by raising the infill speed, but with my cheap printer, the slower the better. However, most of my prints take hours longer at this speed.
  • perimeters = 3 ; Having thicker walls for the edges of things made my prints significantly stronger without having to up the fill density, which I usually keep at 30-40%.

It’s a bit tedious if you are playing with a new to you printer and don’t know where to start. Having 125 settings to work with really makes it a daunting task, considering the best thing to do is to change one setting at a time. Hopefully these settings will help point someone else in the right direction, or at the very least, help another Colido 3D DIY owner.

Linux – keep it simple.

Slicing the perfect 3D print….

Hopefully all of these higher resolution photos show up well in this post, as I wanted to show you what I’ve been working on. Previously, I talked about the difference between using Slic3r to slice my stl files into gcode, and I was pointing out that with the exact same settings, the slice comes out different between slicing inside the printing program, or if I slice directly in the Slic3r program itself, even though the printing program calls Slic3r to do it’s work.

Overall, it was and still is always better to open up Slic3r and slice the files directly. It does add an extra step, but also adds much better quality to the print.

That said, I’ve been tinkering with making the perfect slice.

If there ever was a tough part to 3D printing, I believe it is slicing your stl into gcode. It has taken me about dozens of slices of adjusting settings one or two at a time to get what I consider the best possible print out of my printer. And by God’s grace, I *think* I’ve finally got it down. But you can check out the pictures and judge for yourself.

For all of these prints, I am using a test print pattern that I found on Thingverse. I wanted to provide a direct link, however, as I write this, Thingverse’s website seems to be down at the moment.

IMG_20190720_091221

Here you can see one of my early prints compared to one of my later prints. Neither of these is the best my printer can do, but it is interesting noting the difference in quality. The upper print was sliced with Cura directly inside the program, with the “fine” settings. It was a complete waste of a print. The lower print was sliced with Slic3r using settings that I thought would work for my printer. It is better, but not much.

You can see that it has a star and a hexagon, and three circles. The pyramid, cup, and dome are all there, but it is not a good print. Between the dome and the three circles on the bottom, there should be “comb” like teeth, but they don’t go all the way through to the table, and between the circles and star are words, that should be clear all the way through to the table, but are not. So more work was needed.

Then, I found a printer settings file for the Colido 3D DIY printer that was for Mac users, and I loaded that into Slic3r. It worked better, but still had issues.

IMG_20190721_102416

This picture is a bit hard to see, but on the bottom, the print was not adhering to the platform, making the base of the print unstable for the prints made on top of it. There also was a bad “shift” through the middle of the print, where every print came out with a few layers shifted over to the left or right, making the prints very poor.

IMG_20190721_170829.jpg

Notice how the “cup” and pyramid in this picture shift slowly to the left, instead of being centered and growing up like they should.

IMG_20190721_170000

Finally, after literally dozens of prints, I was able to make a pretty good one. The one on the platform just finished and is the best one yet. The one next to it was the previous best, for comparison. Notice on the good one that the circles and holes are very clear and distinct. Also notice that for the first time of all the prints, the spire, or skinny tower actually printed.

IMG_20190721_170020

In this close up, you can see that the cup is not shifted over at all, and the words are visible! The clarity of the print is dramatically better as well.

So, how’d I get here? What is the point of this post?

Well, next post I’ll share my configuration file, in case you have a Colido 3D DIY printer, but chances are you don’t. I wanted to put out a few tips for other beginners (like me) who may be ready to throw in the towel on their 3D printer, and hope that it generically helps someone else out.

So, my newbie tips:

  • Make sure your belts and gears and motor mounts are tight. If there is any slop or play in them, your pints will turn out bad.
  • Double check that the bed is level, mine is ever so slightly warped, so I found one corner I don’t use for prints. Instead I move the object to be printed to the other corner, which is flat.
  • If, like me, your printer is not one of the select-able options in the list of printers, be sure to reference your manual for the printer details to put into the slicing program you use. I know this seems too easy, but it will give you a better starting point that adjusting all the settings from the default. The default extruder was 0.35 mm, but mine was actually 0.4 mm. So I had a kind of overlap in my prints, or it would melt another part that was already laid.
  • Choose the filament settings to match your current filament. Again, seems to easy, but I didn’t realize the first few prints were with “2.85mm” instead of the actual “1.75mm” filament that I really had. This made for wide gaps between things because it thought the filament was wider, and would feed less to the extruder.
  • Once every thing is set per your machine and filament, now you need to start adjusting the settings one at a time, performing a print, and then seeing the results. For me, I made a small 10 mm block with an angled cut across the face to print dozens of times and see the differences, before moving on to bigger and finer prints.
  • Don’t be afraid to waste some filament. If you don’t do it now, you will be wasting it later on bad prints.
  • If you change filaments between prints, I found that it actually completely changed to game. Switching between two brands seemed (for me) to change the quality of the print. Stick with one filament brand, to keep things simple. I’m not sure if changing colors within a brand matter, because I changed brand and color all at once, which had a dramatic impact on my print and required more adjustment.
  • For me, slower speeds seems to make a better print. Faster print speeds make sloppy prints, probably due to my low cost, low grade printer. Remember, “fast is slow” because you will waste time reprinting bad prints.
  • You don’t need to make an object fill solid to make an object feel solid. Having 3 top, bottom, and wall layers that are solid will really make a part rigid while keeping the internal fill down.
  • That said, I prefer higher fills than recommended, like 40% rather than 20-30% as recommended.
  • Temperature matters. My filament says 180-210 degrees. The print quality is best for me at 195 degrees. I don’t know if it happens to be in the middle or if the middle temperature is always best, because I don’t have enough to try. But, making it too hot will make it impossible to remove from the platform and can make bridge areas kind of droopy. Having it too cold will make the layers stand out as separate.

Your mileage may vary, but I want to encourage other newbies like me that good prints can be made. If your prints turn out poor, spend a little more time adjusting your slicing software, because it will make a difference.

Linux – keep it simple.

Home Photo Server, Part 4: Battery Backup

download

One of the problems that I have with a local server is that we frequently have power “blips”. I don’t want to say outages, because the power is on about 99% of the time. The issue that we have is occasional “brown outs” where the power dips, but doesn’t drop out about once a month. We also have noticed about every other week it seems that the power will blink for just a moment.

Usually about three or four times a year the power will actually go out for more than an hour. It’s not uncommon for a minute long outage on a regular basis though. The worst outage we had was about 3 years ago, when the power was out at our house for 4 days! It was winter time, and I had to run the generator to keep the boiler going. Needless to say, we are prepared around here for the power to go out.

And that’s why I wanted my computer to be prepared as well. Anytime you are using something as a server that you want to make sure it is still running, you really should have it on a backup. So, I purchased an APC BackUPS 1350. By the specs, and it’s own digital display, it should keep my server and monitor running for 15 minutes during an outage.

That’s handy, but I wanted to take it one step further. I’m at work during the week day, and at church on Sunday, so I may not be around when the power goes out. If that happens, having it run for 15 minutes and then die really didn’t help me much. Fortunately, I found some great articles, and installed apcaccess to help me automatically control everything. First I added the EPEL repository, and then installed apcaccess:

# yum install epel-release

# yum install apcupsd

Then I navigated to the apc directory to change my settings…

# cd /etc/apcupsd/

# nano apcupsd.conf

This is a bit lengthy, but here is my apcupsd.conf file, without all the comment lines:

## apcupsd.conf v1.1 ##
#
# for apcupsd release 3.14.14 (31 May 2016) – redhat
#
# “apcupsd” POSIX config file

#
# Note that the apcupsd daemon must be restarted in order for changes to
# this configuration file to become active.
#

#
# ========= General configuration parameters ============
#

UPSNAME SRVRAPC
UPSCABLE usb
UPSTYPE usb
DEVICE
POLLTIME 60
LOCKFILE /var/lock
SCRIPTDIR /etc/apcupsd
PWRFAILDIR /etc/apcupsd
NOLOGINDIR /etc
#
# ======== Configuration parameters used during power failures ==========
#
ONBATTERYDELAY 6
BATTERYLEVEL 20
MINUTES 5
TIMEOUT 0
ANNOY 60
ANNOYDELAY 60
NOLOGON disable
KILLDELAY 0
#
# ==== Configuration statements for Network Information Server ====
#
NETSERVER on
NISIP 127.0.0.1
NISPORT 3551
EVENTSFILE /var/log/apcupsd.events
EVENTSFILEMAX 10
#
# ========== Configuration statements used if sharing =============
# a UPS with more than one machine
UPSCLASS standalone
UPSMODE disable
#
# ===== Configuration statements to control apcupsd system logging ========
#
STATTIME 0
STATFILE /var/log/apcupsd.status
LOGSTATS off
DATATIME 0
#FACILITY DAEMON
#
# ========== Configuration statements used in updating the UPS EPROM =========
#
SELFTEST 336

The important parts being that I set MINUTES to 5, meaning that if the UPS believes that it only has 5 minutes of power left at the current usage rate, it will initiate a computer shutdown command to the server computer. Likewise, if the BATTERYLEVEL drops below 20%, it will also initiate a shutdown command (which, theoretically, would be the 3 minute mark). I suppose you don’t have to set both, but I wanted to make sure under either condition, it shut down the server computer gracefully.

A really funny parameter is NETSERVER on and NISIP 127.0.0.1. At first I turned these off, but then found that the USB connection to the UPS didn’t work unless they were on and set to the local interface. So be sure you turn those on if you are using one of these as well.

Be sure to start the service and make sure it’s enabled:

# systemctl stop apcupsd
# systemctl start apcupsd
# systemctl enable apcupsd

After all of that, now I can just type apcaccess to see the UPS status:

APC : 001,036,0880
DATE : 2019-07-01 09:13:37 -0800
HOSTNAME : localhost.localdomain
VERSION : 3.14.14 (31 May 2016) redhat
UPSNAME : SRVRAPC
CABLE : USB Cable
DRIVER : USB UPS Driver
UPSMODE : Stand Alone
STARTTIME: 2019-06-27 14:34:23 -0800
MODEL : Back-UPS NS 1350M2
STATUS : ONLINE
LINEV : 121.0 Volts
LOADPCT : 34.0 Percent
BCHARGE : 100.0 Percent
TIMELEFT : 16.3 Minutes
MBATTCHG : 20 Percent
MINTIMEL : 5 Minutes
MAXTIME : 0 Seconds
SENSE : Medium
LOTRANS : 88.0 Volts
HITRANS : 139.0 Volts
ALARMDEL : No alarm
BATTV : 27.3 Volts
LASTXFER : No transfers since turnon
NUMXFERS : 0
TONBATT : 0 Seconds
CUMONBATT: 0 Seconds
XOFFBATT : N/A
SELFTEST : NO
STATFLAG : 0x05000008
SERIALNO : 3B1907X23168
BATTDATE : 2019-02-13
NOMINV : 120 Volts
NOMBATTV : 24.0 Volts
NOMPOWER : 810 Watts
FIRMWARE : 954.e3 .D USB FW:e3
END APC : 2019-07-01 09:14:06 -0800

I might play with the high/low transfer, it seems a bit to wide of a spectrum to me, but we’ll see how it does. Either way, I feel a lot safer now in terms of power problems for my server.

Linux – keep it simple.

Home Photo Server, Part 3: https, keys, and certificates

In the continuing saga of the Google Photos alternative, by running a home server with Dynamic Domain Name Service (DDNS), very secure FTP (vsftp), and an Apache web server coupled with Piwigo, we’ve automated the entire process of getting the photographs I take with my phone all put on the server and view-able by those we share it with. And, to God be the glory, it even works! But there are still a few more steps to consider, and today I’d like to look at a more secure interface with https.

So, for https, one of the big things you need to have secure http (the language of the web), is a public/private key pair, for assymetric encryption, and a digital certificate, certifying that those keys are in fact yours. There are a couple of ways to do this on the cheap. Of course, you could pay for a domain name and certificate from a company (like VeriSign and others). Or, you can go with a free certificate from Let’s Encrypt. The only problem that I had with them is that they didn’t seem to support DDNS. Perhaps further research is required. But, if you are using a static IP address, with a domain name, then you certainly can do these options.

Another option, no matter what the use, is self generating your certificate. Now, we do have to clarify, most browsers will warn the user that something is wrong when they go to your web page because the certificate is not signed by a “trusted” source. However, since, in my case, my wife and I are the only ones who log in, I think we can trust our own certificate. The benefit to having your own certificate verses not having one is that now we can use https. If we add the certificate as trusted to the browser, then we will be able to know that we are still talking to our own server, as long as the certificate doesn’t change.

First thing we need is mod_ssl:

# yum install mod_ssl

Once that installs, we need to make a directory for our keys and set the permissions:

# mkdir /etc/ssl/private
# chmod 700 /etc/ssl/private

And of course, generate the keys themselves, as well as set Diffie-Hellman parameters on them for more security:

# openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/ssl/private/apache-selfsigned.key -out /etc/ssl/certs/apache-selfsigned.crt
# openssl dhparam -out /etc/ssl/certs/dhparam.pem 2048
# cat /etc/ssl/certs/dhparam.pem | tee -a /etc/ssl/certs/apache-selfsigned.crt

Then, we need to tell Apache, our web server, to use our certificates:

# nano /etc/httpd/conf.d/ssl.conf

Edit as appropriate to point to your new keys and certificate. You can also make a forced redirect to have all http traffic be redirected to https:

# nano /etc/httpd/conf.d/non-ssl.conf

In the file, write this, but replace with your server name:

<VirtualHost *:80>
ServerName yourServerName
Redirect “/” “https://yourServerName&#8221;
</VirtualHost>

Now you need to punch a few holes in the firewall for https traffic….

# firewall-cmd –add-service=https
# firewall-cmd –runtime-to-permanent

And restart everything:

# systemctl restart httpd.service

# firewall-cmd –reload

Now you should be able to check out your website via https! Here you can see the warning message I get for my self generated certificate.

httpsPiwigo

Linux – keep it simple.

Home photo server, part 2: Apache, phpAlbum, and Piwigo

Last time we talked about how to set up the domain name with DDNS for free, and then using very secure FTP, vsftp, and SyncTool (the Android app) to automatically move photos from your phone to your home server. But that’s only half of the battle. One of the big perks to using Google Photos is that you can browse them anytime from anywhere. You can share them with friends, make comments on them, and other socially related things. We need a way to do that from our home server, too.

There are many, many methods to accomplish this, and I tried several, but I’d like to point out two options that worked really well, were simple to use and set up, and used little to no JavaScript. There are several reasons why one might not want to use JS, like security, etc., but I’ll save that for another post. The two best options were phpAlbum, which is 100% JS free, and Piwigo, which only uses JS for some display themes, I chose one without it and it seems to work just fine.

Either way, I needed a web server, so I installed Apache.

# yum install httpd

# systemctl enable httpd

#firewall-cmd –add-port=80/tcp

# firewall-cmd –add-port=80/tcp –permanent

Right out of the box, you could browse to my web server. Of course, it was insecure and it only displayed the main page. I’ll break down adding certs and making it TLS and SSL compliant in another post. I was ready to set up my router, make sure you route that traffic to your server! Since that is rather router specific, you’ll have to look that up on your own, but there are tons of guides on it. Now it was time to install a photo gallery web server.

So, first on the list, I tried phpAlbum. It worked great and seems to be a good fit, provided that you have a smaller photo collection. One big plus is that it doesn’t need a MySQL database or anything. The only downside: once I surpassed 8000 photos, and numerous folders, it seemed to not be able to keep up. So, for a short time I got around this by setting up multiple web pages, each running a unique instance of phpAlbum, each with it’s own set of photos. This was simple, really, I made one for a couple of years worth, and one for the next 3 or 4 years, and then had a main web page that linked to the different ones. This is a bit tedious and cumbersome though, but wasn’t too bad if you have a lot of static images.

Since it is so simple, and has a good installation guide, which you can read here, I’ll be very brief about how I set this up. You can also click here for a phpAlbum demo.

# yum install php php-xml php-mbstring php-gd

# yum install ImageMagick

# yum install unzip zip

After downloading the latest phpAlbum zip from their website, unzip it and edit config_change_it.php to your needs with nano or vi, basically by setting the data directory and the photo directory, and rename it config.php. Now copy the entire directory to /var/www/html. So in my setup, it was /var/www/html/phpAlbum/ with all of the files in it.

Next, chmod 777 the cache, data, and photo directory inside your folder, so you can write to it with other users (the uploading functions). Then:

# chown -R apache:apache /var/www/html/phpAlbum

so your web server can own it (since I’m using Apache as the web server). Now all you have to do is navigate to http://yourDomainNameIPaddress/phpAlbum and you will be greeted by a login, to which the default is admin and admin for the username and password. Once your in, it will ask you a few questions, and you can be up and running in a few minutes! It worked really great, like I mentioned earlier, when I had a smaller photo collection (under 8000 for me, but your mileage may vary).

Since it was struggling with more photos, I decided to switch to Piwigo. You can check out a demo of it here. There is a really, really great guide on TecMint, that I drew from when putting this together, but it was relatively simple. Start by installing the dependencies – note that a lot of these were already installed for phpAlbum, and I’m not 100% sure you need all of these, but this is what I installed:

# yum install php php-xml php-mbstring php-gd wget unzip zip ImageMagick python python-tk python-psyco mariadb-server php-mysqlnd

Now you need to enable and set up your MySQL/mariaDB:

# systemctl enable mariadb

# mysql -u root -p
MariaDB [(none)]> create database piwigo;
MariaDB [(none)]>grant all privileges on piwigo.* to ‘piwigouser’@’localhost’ identified by ‘pass123’;
MariaDB [(none)]>flush privileges;
MariaDB [(none)]>exit

# systemctl restart httpd

Be sure to use your own usernames and passwords. I don’t recommend the defaults! Then you need to download Piwigo and unzip it, placing it in your Apache web server root directory. After you put it in place, you need to set the proper read and write permissions, as well as ownership:

# wget http://piwigo.org/download/dlcounter.php?code=latest -O piwigo.zip
# unzip piwigo.zip
# cp -rf piwigo/* /var/www/html/
# chown -R apache:apache /var/www/html/
# chmod -R 755 /var/www/html/
# chmod -R 777 /var/www/html/_data/

# systemctl restart httpd
# systemctl restart mariadb

Now it’s up to you how you want to handle moving the pictures we automatically uploaded to the server into the Piwigo directory. For instance, you can have your photos upload from your phone to your home directory, and then make a cron job or script, or manually put them into your Piwigo directory. One benefit of this is deleting blurry or useless photos. I like this option best, but that’s my opinion.

Another option is to set the /var/www/html/galleries photo permissions to be writable/readable by others, or add your user to the group and upload your photos directly to it. I tried this as well, and it works good, too. Either way, now all you have to do is use your web browser to navigate to your server, and you should see the Piwigo first login/setup screen.

Choose your options, such as language, etc., tell Piwigo what the MySQL/MariaDB is called and what that password is, and you should be up and running in no time! Now you can log into the web interface as the admin user (that you just set) and start choosing themes, uploading photos with the web app, or syncing the galleries folder for the photos you put there via FTP or moved manually or scripted.

piwigoPublic

In this screenshot, you can see the light theme that I went with, and how there are some photos available for the public to see. If I log in, then I can see the rest of the pictures:

piwigoPrivate

You can have more users and give each user access to certain files, folders, or groups. Groups is nice because you can give “family” the option to see this, and “friends” the option to see that. You can control everything from the web admin screen:

piwigoAdmin

Another plus to Piwigo is that there are several Android apps out there, some paid, some free, some open source. So there are options, but quite honestly the web browser of Android works great, since Piwigo has two theme settings, one for desktop browsing, and one for mobile browsing as well. So you can have two different themes, one for each desktop and mobile, to maximize what works best for you.

There’s still a few things to cover though. Right now, it is only using port 80 for unsecure web traffic. We definitely want to use secure http on port 443, so we will cover certificates and security next.

Linux – keep it simple.