{"id":3329,"date":"2023-02-22T19:28:51","date_gmt":"2023-02-22T19:28:51","guid":{"rendered":"http:\/\/wordpress.nationaltrail.k12.oh.us\/ittech\/?p=3329"},"modified":"2023-02-22T19:30:28","modified_gmt":"2023-02-22T19:30:28","slug":"creating-an-ubuntu-22-04-archive-backup-server","status":"publish","type":"post","link":"https:\/\/wordpress.nationaltrail.k12.oh.us\/ittech\/2023\/02\/22\/creating-an-ubuntu-22-04-archive-backup-server\/","title":{"rendered":"Creating an Ubuntu 22.04 Archive\/Backup Server"},"content":{"rendered":"<p>This blog post is oriented toward creating a backup server using Linux Ubuntu 22.04 (or basically any fairly recent version of Ubuntu Linux)<\/p>\n<p><span style=\"color: #ff0000\">All commands are in RED!<\/span><\/p>\n<p><span style=\"color: #0000ff\">All actions are in BLUE!<\/span><\/p>\n<p><span style=\"color: #99cc00\">All variables are in GREEN!<\/span><\/p>\n<p>OS: Ubuntu 22.04<\/p>\n<ul>\n<li>Assumptions\n<ul>\n<li>You already have a VM\/Physical machine set up<\/li>\n<li>You have 2 connected drives (still need to be configured)<\/li>\n<li>You have gone through the Ubuntu setup steps (creating an account, installing the OS, and are currently on the Desktop)<\/li>\n<li>You will be doing this whole install as the root user (I will provide the command in the instructions)<\/li>\n<\/ul>\n<\/li>\n<li><span style=\"color: #0000ff\">Open Terminal<\/span>\n<ul>\n<li>Enable Root\n<ul>\n<li><span style=\"color: #ff0000\">sudo -i<\/span>\n<ul>\n<li>Enter password<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<li>Update Linux\/Packages\n<ul>\n<li><span style=\"color: #ff0000\">apt-get update<\/span><\/li>\n<li><span style=\"color: #ff0000\">apt-get upgrade<\/span><\/li>\n<\/ul>\n<\/li>\n<li>Install gparted (for configuring drives and partitions)\n<ul>\n<li><span style=\"color: #ff0000\">apt-get install gparted<\/span>\n<ul>\n<li><span style=\"color: #ff0000\">Y<\/span><\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<li>Open gparted\n<ul>\n<li><span style=\"color: #ff0000\">gparted<\/span><\/li>\n<\/ul>\n<\/li>\n<li><span style=\"color: #0000ff\">Change the disk you are viewing to the one you need to add\/create partitions for using the dropdown located at the top right of the program<\/span><\/li>\n<li>Create a new partition table\n<ul>\n<li><span style=\"color: #0000ff\">Click device tab<\/span>\n<ul>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400;color: #0000ff\">Click \u201cCreate Partition Table\u201d<\/span><\/li>\n<li><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-3330\" src=\"http:\/\/wordpress.nationaltrail.k12.oh.us\/ittech\/wp-content\/uploads\/sites\/2\/2023\/02\/gparted-1-300x214.jpg\" alt=\"\" width=\"300\" height=\"214\" srcset=\"https:\/\/wordpress.nationaltrail.k12.oh.us\/ittech\/wp-content\/uploads\/sites\/2\/2023\/02\/gparted-1-300x214.jpg 300w, https:\/\/wordpress.nationaltrail.k12.oh.us\/ittech\/wp-content\/uploads\/sites\/2\/2023\/02\/gparted-1-768x548.jpg 768w, https:\/\/wordpress.nationaltrail.k12.oh.us\/ittech\/wp-content\/uploads\/sites\/2\/2023\/02\/gparted-1.jpg 773w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<li>Create a new Partition\n<ul>\n<li><span style=\"color: #0000ff\">Partition tab<\/span>\n<ul>\n<li><span style=\"color: #0000ff\">Click &#8220;New&#8221;<\/span><\/li>\n<li><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-3331\" src=\"http:\/\/wordpress.nationaltrail.k12.oh.us\/ittech\/wp-content\/uploads\/sites\/2\/2023\/02\/gparted2-300x202.jpg\" alt=\"\" width=\"300\" height=\"202\" srcset=\"https:\/\/wordpress.nationaltrail.k12.oh.us\/ittech\/wp-content\/uploads\/sites\/2\/2023\/02\/gparted2-300x202.jpg 300w, https:\/\/wordpress.nationaltrail.k12.oh.us\/ittech\/wp-content\/uploads\/sites\/2\/2023\/02\/gparted2.jpg 646w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/li>\n<\/ul>\n<\/li>\n<li><span style=\"color: #0000ff\">Enter the following settings<\/span> (mostly default, the name of the<span style=\"color: #99cc00\"> partition can change<\/span>)\n<ul>\n<li><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-3332\" src=\"http:\/\/wordpress.nationaltrail.k12.oh.us\/ittech\/wp-content\/uploads\/sites\/2\/2023\/02\/gparted3-300x202.jpg\" alt=\"\" width=\"300\" height=\"202\" srcset=\"https:\/\/wordpress.nationaltrail.k12.oh.us\/ittech\/wp-content\/uploads\/sites\/2\/2023\/02\/gparted3-300x202.jpg 300w, https:\/\/wordpress.nationaltrail.k12.oh.us\/ittech\/wp-content\/uploads\/sites\/2\/2023\/02\/gparted3.jpg 605w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/li>\n<li><span style=\"color: #0000ff\">Click &#8220;Add&#8221; in the bottom right<\/span><\/li>\n<\/ul>\n<\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400;color: #0000ff\">Click the green checkmark to apply the settings you changed<\/span><\/li>\n<\/ul>\n<\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Give yourself permission to edit the partition you made<\/span>\n<ul>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400;color: #0000ff\">Open terminal<\/span>\n<ul>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400;color: #ff0000\">Cd \/media\/<span style=\"color: #99cc00\">LINUX USERNAME<\/span>\/<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"color: #ff0000\"><span style=\"font-weight: 400\">To list your disks, enter \u201c<\/span><span style=\"font-weight: 400\">ls -l\u2019<\/span><\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Change permissions of the drives<\/span>\n<ul>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\"><span style=\"color: #ff0000\">Chown<\/span> <span style=\"color: #99cc00\">YOUR_USERNAME<\/span>:<span style=\"color: #99cc00\">YOUR_USERNAME<\/span> <span style=\"color: #99cc00\">PARTITION_NAME<\/span>\/<\/span><\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">The path to your drive is now in \/media<span style=\"color: #99cc00\">\/YOUR_USERNAME\/PARTITION_NAME<\/span><\/span><\/li>\n<\/ul>\n<\/li>\n<li><span style=\"color: #0000ff\">Create 2 folders and create identical subfolders for each backup you need<\/span>\n<ul>\n<li><span style=\"color: #0000ff\">Folder 1 &#8211; mnt<\/span>\n<ul>\n<li><span style=\"color: #0000ff\">Folder 1 &#8211; TestBU1<\/span><\/li>\n<li><span style=\"color: #0000ff\">Folder 2 &#8211; TestBU2<\/span><\/li>\n<li><span style=\"color: #0000ff\">Folder 3 &#8211; TestBU3<\/span><\/li>\n<\/ul>\n<\/li>\n<li><span style=\"color: #0000ff\">Folder 2 &#8211; backups<\/span>\n<ul>\n<li><span style=\"color: #0000ff\">Folder 1 &#8211; TestBU1<\/span><\/li>\n<li><span style=\"color: #0000ff\">Folder 2 &#8211; TestBU2<\/span><\/li>\n<li><span style=\"color: #0000ff\">Folder 3 &#8211; TestBU3<\/span><\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<li><span style=\"color: #0000ff\">Create a script on the Desktop called &#8220;archive.txt&#8221;<\/span>\n<ul>\n<li><span style=\"color: #0000ff\">Add a &#8220;shebang&#8221; line<\/span>\n<ul>\n<li><span style=\"color: #ff0000\">#!\/bin\/sh<\/span><\/li>\n<\/ul>\n<\/li>\n<li><span style=\"color: #0000ff\">Enter the commands to mount the backups to the \/mnt\/ directory<\/span>\n<ul>\n<li><span style=\"color: #ff0000\">mount -t cifs -o username=<\/span>&lt;WINDOWS ACCOUNT USERNAME&gt;<span style=\"color: #ff0000\">,password=<\/span><span style=\"color: #99cc00\">&lt;WINDOWS ACCOUNT PASSWORD&gt;<\/span><span style=\"color: #ff0000\"> \/\/<\/span><span style=\"color: #99cc00\">&lt;IP ADDRESS OF SHARE&gt;<\/span><span style=\"color: #ff0000\">\/<\/span><span style=\"color: #99cc00\">&lt;SHARE NAME&gt;<\/span> <span style=\"color: #ff0000\">\/ \/media\/<\/span><span style=\"color: #99cc00\">&lt;LINUX ACCOUNT NAME&gt;<\/span><span style=\"color: #ff0000\">\/<span style=\"color: #99cc00\">&lt;<\/span><\/span><span style=\"color: #99cc00\">PARTITION NAME&gt;<\/span><span style=\"color: #ff0000\">\/mnt\/TestBU1<\/span>\n<ul>\n<li>EX: mount -t cifs -o username=winbackups,password=backmeup \/\/192.168.0.100\/share\/ \/media\/LINUX ACCOUNT NAME\/PARTITION NAME\/mnt\/TestBU1<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<li><span style=\"color: #0000ff\">Enter the commands to navigate to that directory<\/span>\n<ul>\n<li><span style=\"color: #ff0000\">cd \/media\/<\/span><span style=\"color: #99cc00\">&lt;LINUX ACCOUNT NAME&gt;<\/span><span style=\"color: #ff0000\">\/<\/span><span style=\"color: #99cc00\">PARTITION NAME<\/span><span style=\"color: #ff0000\">\/mnt\/TestBU1<\/span><\/li>\n<\/ul>\n<\/li>\n<li><span style=\"color: #0000ff\">Enter the commands to copy the files from the \/mnt\/ to the \/backups\/ directory<\/span>\n<ul>\n<li><span style=\"color: #ff0000\">cp -ur \/\/media\/<\/span><span style=\"color: #99cc00\">&lt;LINUX ACCOUNT NAME&gt;<\/span><span style=\"color: #ff0000\">\/<\/span><span style=\"color: #99cc00\">&lt;PARTITION NAME&gt;<\/span><span style=\"color: #ff0000\">\/mnt\/TestBU1\/<\/span><span style=\"color: #99cc00\">foo.txt<\/span> <span style=\"color: #ff0000\">\/\/media\/<\/span><span style=\"color: #99cc00\">&lt;LINUX ACCOUNT NAME&gt;<\/span><span style=\"color: #ff0000\">\/<\/span><span style=\"color: #99cc00\">&lt;PARTITION NAME&gt;<\/span><span style=\"color: #ff0000\">\/backups\/TestBU1<\/span><\/li>\n<\/ul>\n<\/li>\n<li><span style=\"color: #0000ff\">Enter the commands to exit to the root directory<\/span>\n<ul>\n<li><span style=\"color: #ff0000\">cd \/<\/span><\/li>\n<\/ul>\n<\/li>\n<li>The following would be an example of the finished file\n<ul>\n<li>#!\/bin\/sh#Test1BU<br \/>\ncd \/<br \/>\nmount -t cifs -o username=winbackups,password=backmeup \/\/192.168.0.100\/share1\/ \/media\/larchive\/archive\/mnt\/TestBU1<br \/>\ncp -ur \/media\/larchive\/archive\/mnt\/TestBU1\/foo1.txt \/media\/larchive\/archive\/backups\/Test1BU<\/p>\n<p>#Test2BU<br \/>\ncd \/<br \/>\nmount -t cifs -o username=winbackups,password=backmeup \/\/192.168.0.100\/share2\/ \/media\/larchive\/archive\/mnt\/TestBU2<br \/>\ncp -ur \/media\/larchive\/archive\/mnt\/TestBU2\/foo2.txt \/media\/larchive\/archive\/backups\/Test2BU<\/p>\n<p>#Test3BU<br \/>\ncd \/<br \/>\nmount -t cifs -o username=winbackups,password=backmeup \/\/192.168.0.100\/share3\/ \/media\/larchive\/archive\/mnt\/TestBU3<br \/>\ncp -ur \/media\/larchive\/archive\/mnt\/TestBU3\/foo3.txt \/media\/larchive\/archive\/backups\/Test3BU<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<li>OPTIONAL: Make it a cron job\n<ul>\n<li><span style=\"color: #0000ff\">Open terminal<\/span>\n<ul>\n<li><span style=\"color: #ff0000\">cd \/etc\/cron.weekly\/<\/span><\/li>\n<li><span style=\"color: #ff0000\">cp man-db \/home\/LINUX ACCOUNT NAME\/Desktop<\/span><\/li>\n<\/ul>\n<\/li>\n<li><span style=\"color: #0000ff\">Edit the man-db file and add your own custom commands (it will contain exactly what is in the archive.txt file you made).<\/span><\/li>\n<li><span style=\"color: #0000ff\">Rename the &#8220;man-db&#8221; file on the desktop to &#8220;archive&#8221;\u00a0<\/span>\n<ul>\n<li><span style=\"color: #ff0000\">sudo cp \/home\/LINUX ACCOUNT NAME\/Desktop\/archive\/ \/etc\/cron.weekly\/<\/span><\/li>\n<\/ul>\n<\/li>\n<li>This job should now run weekly<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>This blog post is oriented toward creating a backup server using Linux Ubuntu 22.04 (or basically any fairly recent version of Ubuntu Linux) All commands are in RED! All actions are in BLUE! All variables are in GREEN! OS: Ubuntu 22.04 Assumptions You already have a VM\/Physical machine set up You have 2 connected drives &hellip; <a href=\"https:\/\/wordpress.nationaltrail.k12.oh.us\/ittech\/2023\/02\/22\/creating-an-ubuntu-22-04-archive-backup-server\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Creating an Ubuntu 22.04 Archive\/Backup Server<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1303,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[10],"tags":[],"class_list":["post-3329","post","type-post","status-publish","format-standard","hentry","category-it-support"],"_links":{"self":[{"href":"https:\/\/wordpress.nationaltrail.k12.oh.us\/ittech\/wp-json\/wp\/v2\/posts\/3329","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.nationaltrail.k12.oh.us\/ittech\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wordpress.nationaltrail.k12.oh.us\/ittech\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wordpress.nationaltrail.k12.oh.us\/ittech\/wp-json\/wp\/v2\/users\/1303"}],"replies":[{"embeddable":true,"href":"https:\/\/wordpress.nationaltrail.k12.oh.us\/ittech\/wp-json\/wp\/v2\/comments?post=3329"}],"version-history":[{"count":3,"href":"https:\/\/wordpress.nationaltrail.k12.oh.us\/ittech\/wp-json\/wp\/v2\/posts\/3329\/revisions"}],"predecessor-version":[{"id":3335,"href":"https:\/\/wordpress.nationaltrail.k12.oh.us\/ittech\/wp-json\/wp\/v2\/posts\/3329\/revisions\/3335"}],"wp:attachment":[{"href":"https:\/\/wordpress.nationaltrail.k12.oh.us\/ittech\/wp-json\/wp\/v2\/media?parent=3329"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wordpress.nationaltrail.k12.oh.us\/ittech\/wp-json\/wp\/v2\/categories?post=3329"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wordpress.nationaltrail.k12.oh.us\/ittech\/wp-json\/wp\/v2\/tags?post=3329"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}