I am following these instructions, but am giving full detail of my instructions. I am also adding a PHP webpage to reboot the pi remotely without knowing the passwords so other staff can do it.
sudo apt-get update
sudo apt-get dist-upgrade
sudo apt-get install matchbox x11-server-utils unclutter chromium ttf-mscorefonts-installer
sudo reboot
Setup Auto-login
sudo nano /etc/inittab
comment out the line (#)1:2345:respawn:/sbin/getty 115200 tty1
add: 1:2345:respawn:/bin/login -f pi tty1 </dev/tty1 >/dev/tty1 2>&1
That is all I did.
sudo apt-get install php5
cd /var/www
sudo rm index.html
sudo nano index.php
<?php
if(isset($_POST['s'])){
echo "Rebooting NOW<br />\n";
touch('/tmp/reboot.now');
}
?>
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<form action='index.php' method='post'>
<input type='submit' name='s' value='Reboot' />
</form>
</body>
</html>
sudo nano /usr/local/sbin/reboot.sh
#!/bin/bash
if [ -f /tmp/reboot.now ]; then
rm -f /tmp/reboot.now
/sbin/shutdown -r now
fi
sudo chmod +x /usr/local/sbin/reboot.sh
sudo crontab -e
* * * * * /usr/local/sbin/reboot.sh
Tuesday, June 10, 2014
Wednesday, March 19, 2014
Format SD Card with Linux partitions
If you have ever used a Raspberry Pi but had to setup the SD card using a windows computer than you know the frustration you get when the disk only shows 56 Mb instead of the 14 Gb that it should be!
I spend a good hour trying to figure this out every time I try and reformat the card with the latest version of Rasbian. I know I should just keep this in my list of bookmarks, but now I realize that I should just blog the steps as I have with everything else, so that I have it for posterity!
Anyway, Windows 7 has a great tool called diskpart. Never really knew how fantastic it was until now. Back in the day it was fdisk, but diskpart is much more powerful and easier to use!
diskpart
list disk
select disk # (the sd card disk number that was listed above)
clean (clears partition table)
exit
This step seems to be required if using my laptop, but I don't know if everyone has to do this or not.
Pull out the sd card and put it back in after a few seconds.
diskpart
list disk
select disk # (is probably the same, but might not be)
create partition primary
format fs=fat32 quick
exit
Done! It is that easy!
I know that you can also put the card in a camera and format it there to reset the partition table, but I don't have a camera handy all the time!
Hope this helps others.
I spend a good hour trying to figure this out every time I try and reformat the card with the latest version of Rasbian. I know I should just keep this in my list of bookmarks, but now I realize that I should just blog the steps as I have with everything else, so that I have it for posterity!
Anyway, Windows 7 has a great tool called diskpart. Never really knew how fantastic it was until now. Back in the day it was fdisk, but diskpart is much more powerful and easier to use!
diskpart
list disk
select disk # (the sd card disk number that was listed above)
clean (clears partition table)
exit
This step seems to be required if using my laptop, but I don't know if everyone has to do this or not.
Pull out the sd card and put it back in after a few seconds.
diskpart
list disk
select disk # (is probably the same, but might not be)
create partition primary
format fs=fat32 quick
exit
Done! It is that easy!
I know that you can also put the card in a camera and format it there to reset the partition table, but I don't have a camera handy all the time!
Hope this helps others.
Wednesday, February 19, 2014
Increase Ubuntu Hard Drive Size in VMWare ESXi
I have only done this with my Ubuntu virtual machine so far, so I can't tell you if this works for any other form of linux. I will have to test it some time to find out.
My situation: Koha library system loaded on a Ubuntu Server 13.10. I had originally set it up as a test server so I only gave it 2Gb of ram and a 30 Gb hard drive.
Logs can fill up fairly quickly with everything going on, and the database takes space when you have 20,000 book records and 500 student records.
I followed these instructions to increase the hard drive size of my server, on the fly and it worked perfectly, now I have storage space again and the system is working again!
http://www.joomlaworks.net/blog/item/168-resizing-the-disk-space-on-ubuntu-server-vms
First step is to increase the hard drive to the virtual machine. I had lots of space, and could add more, but I thought 80Gb would be a good amount for now. So I increased it by 50Gb to make it 80Gb in total size.
Then access the machine with PuTTy.
List all partitions
$ ls -la /dev/sda*
Create new partition using fdisk:
$ sudo fdisk /dev/sda
p - to list all partitions
n - to create a new partition
l - for "logical"
Accept the default start and end blocks, as that is the new section that has been allocated.
t - to change the partition type
8e - set the type to Linux LVM
p - to list the new partition table
w - to write the changes
A warning message will say that the new drive won't be available until you restart, or use this command:
$ sudo partprobe
Now it is time to create the partition, extend the current volume and reprobe the partition table.
Create partition on new disk - (mine was /dev/sda4, yours might be different)
$ sudo pvcreate /dev/sda4
Display the current volume group and get the name
$ sudo vgdisplay - "VG Name" is what you are looking for here
Extend the volume group with the new partition
$ sudo vgextend VGName /dev/sda4
Get the name of the main logical volume
$ sudo lvdisplay - "LV Name" is what you are looking for here
Extend the logical volume by X Gbs
$ sudo lvextend -l -XG LVName
Resize the file system to account for the new space
$ sudo resize2fs LVName
You can now check to see if the total space is much larger
$ sudo df -hT
This should be all that you need, I did another
$ sudo partprobe
to verify that the system was aware of all the space.
I had some services crash and wouldn't start because of the lack of hard drive space, Apache2 and MySql5 wouldn't start. After this process I was able to sudo service start and they both came up fine.
My situation: Koha library system loaded on a Ubuntu Server 13.10. I had originally set it up as a test server so I only gave it 2Gb of ram and a 30 Gb hard drive.
Logs can fill up fairly quickly with everything going on, and the database takes space when you have 20,000 book records and 500 student records.
I followed these instructions to increase the hard drive size of my server, on the fly and it worked perfectly, now I have storage space again and the system is working again!
http://www.joomlaworks.net/blog/item/168-resizing-the-disk-space-on-ubuntu-server-vms
First step is to increase the hard drive to the virtual machine. I had lots of space, and could add more, but I thought 80Gb would be a good amount for now. So I increased it by 50Gb to make it 80Gb in total size.
Then access the machine with PuTTy.
List all partitions
$ ls -la /dev/sda*
Create new partition using fdisk:
$ sudo fdisk /dev/sda
p - to list all partitions
n - to create a new partition
l - for "logical"
Accept the default start and end blocks, as that is the new section that has been allocated.
t - to change the partition type
8e - set the type to Linux LVM
p - to list the new partition table
w - to write the changes
A warning message will say that the new drive won't be available until you restart, or use this command:
$ sudo partprobe
Now it is time to create the partition, extend the current volume and reprobe the partition table.
Create partition on new disk - (mine was /dev/sda4, yours might be different)
$ sudo pvcreate /dev/sda4
Display the current volume group and get the name
$ sudo vgdisplay - "VG Name" is what you are looking for here
Extend the volume group with the new partition
$ sudo vgextend VGName /dev/sda4
Get the name of the main logical volume
$ sudo lvdisplay - "LV Name" is what you are looking for here
Extend the logical volume by X Gbs
$ sudo lvextend -l -XG LVName
Resize the file system to account for the new space
$ sudo resize2fs LVName
You can now check to see if the total space is much larger
$ sudo df -hT
This should be all that you need, I did another
$ sudo partprobe
to verify that the system was aware of all the space.
I had some services crash and wouldn't start because of the lack of hard drive space, Apache2 and MySql5 wouldn't start. After this process I was able to sudo service start and they both came up fine.
Monday, February 10, 2014
Monthly Board Reports
Our School Board has gone Google and paperless with Google Drive. Starting a year ago we purchased Chromebooks for the board members to use.
These instructions are for how the drive is organized and what to do each month for the board members.
The Google Drive was formed and shared using the tech user account. This way any staff member with access can go in with full rights. It is not tied to a specific staff member.
PSD School Board ->
Agenda
Archive
Consent Agenda
Meeting
Minutes
Policy
SB Reports ->
Athletics
Clerk
Elem Principal
Food Services
HS Principal
Maintenance
SPED
Superintendent
Technology
Transportation
Inside each is a folder for the past school years, for organizational purposes. Add a new folder each year and move the files into those folders to keep it clean.
The Archive folder is where all past meeting files are organized. These are links to the files also stored elsewhere in the drive.
The meeting folder is used by the board for easy access to all files stored throughout the drive. Each month I create a link to the files in this folder. To create a link find the original click the Move To folder button and press and hold the Ctrl key when clicking the Meeting folder. The Ctrl key allows for multiple locations. Then click OK to create the link. Keep all files in the original locations, but add a link to the meeting folder.
At the end of the meeting from the meeting folder, select all files and folders except the policy folder and move these to the Archive folder for that month. To move, but keep the other links you press the Ctrl key and uncheck the meeting folder check and while still holding the Ctrl key click the archive month folder.
All files are named as such:
2014 02C Technology Report
Year | Month | Section of the agenda | Title
Agenda header items are A, Administrative reports are B, Supervisor reports are C
The board group is given view access. Each supervisor has been granted edit rights to the SB Reports folder that corresponds to their position.
These instructions are for how the drive is organized and what to do each month for the board members.
The Google Drive was formed and shared using the tech user account. This way any staff member with access can go in with full rights. It is not tied to a specific staff member.
PSD School Board ->
Agenda
Archive
Consent Agenda
Meeting
Minutes
Policy
SB Reports ->
Athletics
Clerk
Elem Principal
Food Services
HS Principal
Maintenance
SPED
Superintendent
Technology
Transportation
Inside each is a folder for the past school years, for organizational purposes. Add a new folder each year and move the files into those folders to keep it clean.
The Archive folder is where all past meeting files are organized. These are links to the files also stored elsewhere in the drive.
The meeting folder is used by the board for easy access to all files stored throughout the drive. Each month I create a link to the files in this folder. To create a link find the original click the Move To folder button and press and hold the Ctrl key when clicking the Meeting folder. The Ctrl key allows for multiple locations. Then click OK to create the link. Keep all files in the original locations, but add a link to the meeting folder.
At the end of the meeting from the meeting folder, select all files and folders except the policy folder and move these to the Archive folder for that month. To move, but keep the other links you press the Ctrl key and uncheck the meeting folder check and while still holding the Ctrl key click the archive month folder.
All files are named as such:
2014 02C Technology Report
Year | Month | Section of the agenda | Title
Agenda header items are A, Administrative reports are B, Supervisor reports are C
The board group is given view access. Each supervisor has been granted edit rights to the SB Reports folder that corresponds to their position.
Friday, February 7, 2014
Update Linux Servers
I like to do these steps on each server listed once a month. You can do it as often or as little as you like.
These steps are specific to my servers, but only in terms of Debian and Ubuntu. Some things are specific for the setup here at Potlatch SD.
I have blanked out any passwords and usernames, those can be retrieved from documentation.
Web Server/Piler Server
Use Putty, it is the easiest SSH software out there.
At the initial prompt you need to su to do the update process.
$ su
$ apt-get update
$ apt-get upgrade
$ apt-get autoclean
$ apt-get autoremove
When that is complete then you can type exit twice to close out.
Koha Server
This is similar to above, but since it is Ubuntu you can use sudo instead of su at the beginning.
$ sudo apt-get update
$ sudo apt-get upgrade
If Koha was upgraded then you have to go and adjust the Circulation file to allow the scanners to work properly. instead of programming the scanners or changing the barcodes on every book now, I have modified the programming to adjust the barcode after scan at the elementary. The instructions are found on this blog under PSD Koha Circulation Barcode Modification.
$ sudo apt-get autoclean
$ sudo apt-get autoremove
When that is complete then you can type exit to close out.
PFSense Firwall/Gateway Server
This server checks for updates and will display if an update is needed on the dashboard. To upgrade you can click on the link and follow the instructions, the server will upgrade in place without much major interruption. I have done the update during the school day and only had the network disconnect for a few seconds while the service restarts. Some major updates require a restart so those should be done at the end of the day.
The Packages can be updated at anytime as well. These are add-ons that have been used to increase the effectiveness of the server. When you click on System -> Packages the next screen shows you what is installed. Anything that is highlighted in the version column has an update. To load that update click on the PKG button next to the row. That will install the update automatically.
These steps are specific to my servers, but only in terms of Debian and Ubuntu. Some things are specific for the setup here at Potlatch SD.
I have blanked out any passwords and usernames, those can be retrieved from documentation.
Web Server/Piler Server
Use Putty, it is the easiest SSH software out there.
At the initial prompt you need to su to do the update process.
$ su
$ apt-get update
$ apt-get upgrade
$ apt-get autoclean
$ apt-get autoremove
When that is complete then you can type exit twice to close out.
Koha Server
This is similar to above, but since it is Ubuntu you can use sudo instead of su at the beginning.
$ sudo apt-get update
$ sudo apt-get upgrade
If Koha was upgraded then you have to go and adjust the Circulation file to allow the scanners to work properly. instead of programming the scanners or changing the barcodes on every book now, I have modified the programming to adjust the barcode after scan at the elementary. The instructions are found on this blog under PSD Koha Circulation Barcode Modification.
$ sudo apt-get autoclean
$ sudo apt-get autoremove
When that is complete then you can type exit to close out.
PFSense Firwall/Gateway Server
This server checks for updates and will display if an update is needed on the dashboard. To upgrade you can click on the link and follow the instructions, the server will upgrade in place without much major interruption. I have done the update during the school day and only had the network disconnect for a few seconds while the service restarts. Some major updates require a restart so those should be done at the end of the day.
The Packages can be updated at anytime as well. These are add-ons that have been used to increase the effectiveness of the server. When you click on System -> Packages the next screen shows you what is installed. Anything that is highlighted in the version column has an update. To load that update click on the PKG button next to the row. That will install the update automatically.
Friday, January 3, 2014
Factory Reset Chromebook
I have recently purchased a few Chromebooks. We have both Acer and Samsung. These instructions worked on both.
When joining a Chromebook to our local email domain for management the process is fairly straightforward. You wait for the sign in screen, but instead of signing in you press Ctrl-E. This then brings up another sign in screen, and I have entered the admin email and password, then the system says enrolled and the sign in screen actually comes up, but now says that this device is managed by my email domain.
Sometimes during this process the device doesn't enroll properly. The only way to fix that is to factory reset the device and try again.
I had to call support to get this information, but since it worked on both types of devices I am blogging it for my future reference!
With the device turned off completely follow these instructions:
Esc - Refresh - Power button The refresh button is F3 on both of the devices, but is usually represented by a circular arrow.
Once the device comes up to the developer mode press:
Ctrl - D and the Enter key.
This will send the device into develop reset mode. It will probably take a few minutes to wipe the device. It will restart a few times. When it is done it will go right back to the initial process as if you just turned it on for the first time.
The device can now be enrolled in the domain for management.
The Acer device needed the developer mode turned off, which is just the above process again. The Samsung didn't need that step.
Hopefully this helps others, or at least is for my reference.
When joining a Chromebook to our local email domain for management the process is fairly straightforward. You wait for the sign in screen, but instead of signing in you press Ctrl-E. This then brings up another sign in screen, and I have entered the admin email and password, then the system says enrolled and the sign in screen actually comes up, but now says that this device is managed by my email domain.
Sometimes during this process the device doesn't enroll properly. The only way to fix that is to factory reset the device and try again.
I had to call support to get this information, but since it worked on both types of devices I am blogging it for my future reference!
With the device turned off completely follow these instructions:
Esc - Refresh - Power button The refresh button is F3 on both of the devices, but is usually represented by a circular arrow.
Once the device comes up to the developer mode press:
Ctrl - D and the Enter key.
This will send the device into develop reset mode. It will probably take a few minutes to wipe the device. It will restart a few times. When it is done it will go right back to the initial process as if you just turned it on for the first time.
The device can now be enrolled in the domain for management.
The Acer device needed the developer mode turned off, which is just the above process again. The Samsung didn't need that step.
Hopefully this helps others, or at least is for my reference.
Thursday, January 2, 2014
PSD Koha Circulation Barcode Modification
So I spent a few summers ago upgrading the library system to Koha. It was actually fairly painless to do with the help of linux. But I ran into an issue of barcodes matching at both schools. So to eliminate that I added an e to the barcodes for the elementary. Now to get the scanner to put the e on at the end so the librarian wouldn't have to add it manually.
Instead of making the scanner do that work I found that you can modify the Circulation file in Koha to do that work for you. In our situation that was good since the books at the high school have added number data in the barcode as well.
So here is the location of the file:
/usr/share/koha/lib/C4/Circulation.pm
This is what I modified to get it to work:
Original:
elsif ($filter eq 'T-prefix') {
if ($barcode =~ /^[Tt](\d)/} {
(defined($1) and $1 eq '0') and return $barcode;
$barcode = substr($barcode, 2) + 0;
}
return sprintf("T%07d", $barcode);
New:
if($branch eq '0762' and substr($barcode, -1) eq 'e'){
return $barcode;}
elsif($branch eq '0135' and length($barcode) >= 6){
$barcode = substr($barcode, 2, 5);
}
if(substr($barcode, 0, 1) eq 'T'){
if(substr($barcode, 1, 1) eq ' '){
$barcode = substr($barcode, 2);}
else{$barcode = substr($barcode, 1);}
}
$barcode = substr($barcode, -5);
if($branch eq '0762'){
return sprintf("%05de", $barcode);
} else {
return sprintf("%05d", $barcode);
}
Instead of making the scanner do that work I found that you can modify the Circulation file in Koha to do that work for you. In our situation that was good since the books at the high school have added number data in the barcode as well.
So here is the location of the file:
/usr/share/koha/lib/C4/Circulation.pm
This is what I modified to get it to work:
Original:
elsif ($filter eq 'T-prefix') {
if ($barcode =~ /^[Tt](\d)/} {
(defined($1) and $1 eq '0') and return $barcode;
$barcode = substr($barcode, 2) + 0;
}
return sprintf("T%07d", $barcode);
New:
if($branch eq '0762' and substr($barcode, -1) eq 'e'){
return $barcode;}
elsif($branch eq '0135' and length($barcode) >= 6){
$barcode = substr($barcode, 2, 5);
}
if(substr($barcode, 0, 1) eq 'T'){
if(substr($barcode, 1, 1) eq ' '){
$barcode = substr($barcode, 2);}
else{$barcode = substr($barcode, 1);}
}
$barcode = substr($barcode, -5);
if($branch eq '0762'){
return sprintf("%05de", $barcode);
} else {
return sprintf("%05d", $barcode);
}
Subscribe to:
Posts (Atom)