How to Setup Two Factor Authentication for SSH on Fedora

by Ravi Saive | Published: March 20, 2019 |

March 20, 2019

‘,
enableHover: false,
enableTracking: true,
buttons: { twitter: },
click: function(api, options){
api.simulateClick();
api.openPopup(‘twitter’);
}
});
jQuery(‘#facebook’).sharrre({
share: {
facebook: true
},
template: ‘

‘,
enableHover: false,
enableTracking: true,
click: function(api, options){
api.simulateClick();
api.openPopup(‘facebook’);
}
});
jQuery(‘#googleplus’).sharrre({
share: {
googlePlus: true
},
template: ‘

‘,
enableHover: false,
enableTracking: true,
urlCurl: ‘https://www.tecmint.com/wp-content/themes/tecmint/js/sharrre.php’,
click: function(api, options){
api.simulateClick();
api.openPopup(‘googlePlus’);
}
});
jQuery(‘#linkedin’).sharrre({
share: {
linkedin: true
},
template: ‘

‘,
enableHover: false,
enableTracking: true,
buttons: {
linkedin: {
description: ‘How to Setup Two Factor Authentication for SSH on Fedora’,media: ‘https://www.tecmint.com/wp-content/uploads/2019/03/two-factor-authentication-for-ssh-fedora.jpg’ }
},
click: function(api, options){
api.simulateClick();
api.openPopup(‘linkedin’);
}
});
// Scrollable sharrre bar, contributed by Erik Frye. Awesome!
var shareContainer = jQuery(“.sharrre-container”),
header = jQuery(‘#header’),
postEntry = jQuery(‘.entry’),
$window = jQuery(window),
distanceFromTop = 20,
startSharePosition = shareContainer.offset(),
contentBottom = postEntry.offset().top + postEntry.outerHeight(),
topOfTemplate = header.offset().top;
getTopSpacing();
shareScroll = function(){
if($window.width() > 719){
var scrollTop = $window.scrollTop() + topOfTemplate,
stopLocation = contentBottom – (shareContainer.outerHeight() + topSpacing);
if(scrollTop > stopLocation){
shareContainer.offset();
}
else if(scrollTop >= postEntry.offset().top-topSpacing){
shareContainer.offset();
}else if(scrollTop 1024)
topSpacing = distanceFromTop + jQuery(‘.nav-wrap’).outerHeight();
else
topSpacing = distanceFromTop;
}
});

If You Appreciate What We Do Here On TecMint, You Should Consider:

  1. Stay Connected to: Twitter | Facebook | Google Plus
  2. Subscribe to our email updates: Sign Up Now
  3. Get your own self-hosted blog with a Free Domain at ($3.45/month).
  4. Become a Supporter – Make a contribution via PayPal
  5. Support us by purchasing our premium books in PDF format.
  6. Support us by taking our online Linux courses

We are thankful for your never ending support.

View all Posts

Ravi Saive

I am Ravi Saive, creator of TecMint. A Computer Geek and Linux Guru who loves to share tricks and tips on Internet. Most Of My Servers runs on Open Source Platform called Linux. Follow Me: Twitter, Facebook and Google+

Your name can also be listed here. Got a tip? Submit it here to become an TecMint author.

Source

Germany Dedicated Server

How to configure a static IP address on Linux

When you need a Linux system to have a static IP address rather than one that is set dynamically by DHCP, all that’s required is some configuration changes and a restart. Follow these steps to make the switch.

“);
});
try {
$(“div.lazyload_blox_ad”).lazyLoadAd({
threshold : 0, // You can set threshold on how close to the edge ad should come before it is loaded. Default is 0 (when it is visible).
forceLoad : false, // Ad is loaded even if not visible. Default is false.
onLoad : false, // Callback function on call ad loading
onComplete : false, // Callback function when load is loaded
timeout : 1500, // Timeout ad load
debug : false, // For debug use : draw colors border depends on load status
xray : false // For debug use : display a complete page view with ad placements
}) ;
}
catch (exception){
console.log(“error loading lazyload_ad ” + exception);
}
});

IP addresses on Linux systems are often assigned automatically by Dynamic Host Configuration Protocol (DHCP) servers. These are referred to as “dynamic addresses” and may change any time the system is rebooted. When a system is a server or will be remotely administered, however, it is generally more convenient for these systems to have static addresses, providing stable and consistent connections with users and applications.

Fortunately, the steps required to change a Linux system’s IP address from dynamic to static are fairly easy, though they will be a little different depending on the distribution you are using. In this post, we’ll look at how this task is managed on both Red Hat (RHEL) and Ubuntu systems.

There’s no simple command that you can run to determine whether the IP address on a Linux system is assigned by DHCP or static. If it changes when the system restarts, it’s clearly dynamically assigned, but even a dynamic address has some resistance to change. The best way is to look at the configuration file. More on this in the sections below.

RHEL 8

To configure a static IP address on a Red Hat system, let’s start by listing NetworkManager’s connection. The nmcli command shown below will list network connections and devices on the system. Note that the device names and the connection names are not the same.

$ nmcli dev status
DEVICE TYPE STATE CONNECTION
wlo1 wifi connected Comtrend7FB9
virbr0 bridge connected virbr0
enp3s0 ethernet unavailable —
lo loopback unmanaged —
virbr0-nic tun unmanaged —

To change the network interface from dynamic to static, you need to edit the file in the /etc/sysconfig/network-scripts directory that represents the public interface. In this example, it’s called ifcfg-Comtrend7BF9 (ifcfg- followed by the name of the connection). The boot protocol “BOOTPROTO=dhcp” line needs to be changed to “BOOTPROTO=static”. In addition, the IP address to be used has to be added to the file. The end result will look something like this (NOTE: Don’t add the “arrows” inserted below to highlight the lines you need to focus on):

HWADDR=7C:67:2A:CF:EF:9F
ESSID=Comtrend7FB9
MODE=Managed
KEY_MGMT=WPA-PSK
SECURITYMODE=open
MAC_ADDRESS_RANDOMIZATION=default
TYPE=Wireless
IPADDR=192.168.0.22 <==
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=static <==
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=Comtrend7FB9
UUID=2f5a6217-37c7-449f-bfaa-1d3fa5283482
ONBOOT=yes

Run the command systemctl restart NetworkManager after the changes have been made to make the changes effective.

Ubuntu 18.10

The nmcli (network manager command line interface) command can be used to list the network interfaces on an Ubuntu system. In the output below, we see both a loopback and a public network interface listed. The device on your system may have a different name. This one that reflects the location of the hardware.

Ubuntu> nmcli d
DEVICE TYPE STATE CONNECTION
enp0s25 ethernet unmanaged —
lo loopback unmanaged —

To examine the network interface configuration settings on an Ubuntu system, you would use a command like this:

Ubuntu> cat /etc/network/interfaces
# interfaces(5) file used by ifup(8) and ifdown(8)
auto lo
iface lo inet loopback
auto enp0s25
iface enp0s25 inet dhcp <== dynamically assigned

You can see from the last line in this output that the eth0 interface is currently assigned by DHCP. To change the setting to dynamic, you would change “dhcp” to “static” and add some other lines as well. For example, in the file as shown below, we have changed dhcp to static and specified the IP address we want to use along with other settings:

# interfaces(5) file used by ifup(8) and ifdown(8)
auto lo
iface lo inet loopback
auto enp0s25
iface enp0s25 inet static
address 192.168.0.11
netmask 255.255.255.0
network 192.168.0.0
broadcast 192.168.0.255

Restart the networking service or reboot the system to make the changes effective.

Wrap-up

Changing network settings should be done only when the changes will not affect current connections and you can back out the changes if needed. It’s always a good idea to make a copy of any configuration file before you make changes. Giving your backup copy a predictable name such as interfaces.prev, interfaces.orig or interfaces- will make it a little easier to identify.

Join the Network World communities on

Facebook

and

LinkedIn

to comment on topics that are top of mind.

Sandra Henry-Stocker has been administering Unix systems for more than 30 years. She describes herself as “USL” (Unix as a second language) but remembers enough English to write books and buy groceries. She lives in the mountains in Virginia where, when not working with or writing about Unix, she’s chasing the bears away from her bird feeders.

Source

Germany Dedicated Server

Sweet Home 3D: An open source tool to help you decide on your dream home

I recently accepted a new job in Virginia. Since my wife was working and watching our house in New York until it sold, it was my responsibility to go out and find a new house for us and our cat. A house that she would not see until we moved into it!

I contracted with a real estate agent and looked at a few houses, taking many pictures and writing down illegible notes. At night, I would upload the photos into a Google Drive folder, and my wife and I would review them simultaneously over the phone while I tried to remember whether the room was on the right or the left, whether it had a fan, etc.

Since this was a rather tedious and not very accurate way to present my findings, I went in search of an open source solution to better illustrate what our future dream house would look like that wouldn’t hinge on my fuzzy memory and blurry photos.

Sweet Home 3D did exactly what I wanted it to do. Sweet Home 3D is available on Sourceforge and released under the GNU General Public License. The website is very informative, and I was able to get it up and running in no time. Sweet Home 3D was developed by Paris-based Emmanuel Puybaret of eTeks.

Hanging the drywall

I downloaded Sweet Home 3D onto my MacBook Pro and added a PNG version of a flat floorplan of a house to use as a background base map.

From there, it was a simple matter of using the Rooms palette to trace the pattern and set the “real life” dimensions. After I mapped the rooms, I added the walls, which I could customize by color, thickness, height, etc.

Now that I had the “drywall” built, I downloaded various pieces of “furniture” from a large array that includes actual furniture as well as doors, windows, shelves, and more. Each item downloads as a ZIP file, so I created a folder of all my uncompressed pieces. I could customize each piece of furniture, and repetitive items, such as doors, were easy to copy-and-paste into place.

Once I had all my walls and doors and windows in place, I used the application’s 3D view to navigate through the house. Drawing upon my photos and memory, I made adjustments to all the objects until I had a close representation of the house. I could have spent more time modifying the house by adding textures, additional furniture, and objects, but I got it to the point I needed.

After I finished, I exported the plan as an OBJ file, which can be opened in a variety of programs, such as Blender and Preview on the Mac, to spin the house around and examine it from various angles. The Video function was most useful, as I could create a starting point, draw a path through the house, and record the “journey.” I exported the video as a MOV file, which I opened and viewed on the Mac using QuickTime.

My wife was able to see (almost) exactly what I saw, and we could even start arranging furniture ahead of the move, too. Now, all I have to do is load up the moving truck and head south.

Sweet Home 3D will also prove useful at my new job. I was looking for a way to improve the map of the college’s buildings and was planning to just re-draw it in Inkscape or Illustrator or something. However, since I have the flat map, I can use Sweet Home 3D to create a 3D version of the floorplan and upload it to our website to make finding the bathrooms so much easier!

An open source crime scene?

An interesting aside: according to the Sweet Home 3D blog, “the French Forensic Police Office (Scientific Police) recently chose Sweet Home 3D as a tool to design plans [to represent roads and crime scenes]. This is a concrete application of the recommendation of the French government to give the preference to free open source solutions.”

This is one more bit of evidence of how open source solutions are being used by citizens and governments to create personal projects, solve crimes, and build worlds.

Source

Germany Dedicated Server

3 Ways to Install Spotify [Music Streaming] in Fedora Linux

by Aaron Kili | Published: March 9, 2019 |
Last Updated: March 9, 2019

‘,
enableHover: false,
enableTracking: true,
buttons: { twitter: },
click: function(api, options){
api.simulateClick();
api.openPopup(‘twitter’);
}
});
jQuery(‘#facebook’).sharrre({
share: {
facebook: true
},
template: ‘

‘,
enableHover: false,
enableTracking: true,
click: function(api, options){
api.simulateClick();
api.openPopup(‘facebook’);
}
});
jQuery(‘#googleplus’).sharrre({
share: {
googlePlus: true
},
template: ‘

‘,
enableHover: false,
enableTracking: true,
urlCurl: ‘https://www.tecmint.com/wp-content/themes/tecmint/js/sharrre.php’,
click: function(api, options){
api.simulateClick();
api.openPopup(‘googlePlus’);
}
});
jQuery(‘#linkedin’).sharrre({
share: {
linkedin: true
},
template: ‘

‘,
enableHover: false,
enableTracking: true,
buttons: {
linkedin: {
description: ‘3 Ways to Install Spotify [Music Streaming] in Fedora Linux’,media: ‘https://www.tecmint.com/wp-content/uploads/2019/03/Install-Spotify-in-Fedora.png’ }
},
click: function(api, options){
api.simulateClick();
api.openPopup(‘linkedin’);
}
});
// Scrollable sharrre bar, contributed by Erik Frye. Awesome!
var shareContainer = jQuery(“.sharrre-container”),
header = jQuery(‘#header’),
postEntry = jQuery(‘.entry’),
$window = jQuery(window),
distanceFromTop = 20,
startSharePosition = shareContainer.offset(),
contentBottom = postEntry.offset().top + postEntry.outerHeight(),
topOfTemplate = header.offset().top;
getTopSpacing();
shareScroll = function(){
if($window.width() > 719){
var scrollTop = $window.scrollTop() + topOfTemplate,
stopLocation = contentBottom – (shareContainer.outerHeight() + topSpacing);
if(scrollTop > stopLocation){
shareContainer.offset();
}
else if(scrollTop >= postEntry.offset().top-topSpacing){
shareContainer.offset();
}else if(scrollTop 1024)
topSpacing = distanceFromTop + jQuery(‘.nav-wrap’).outerHeight();
else
topSpacing = distanceFromTop;
}
});

If You Appreciate What We Do Here On TecMint, You Should Consider:

  1. Stay Connected to: Twitter | Facebook | Google Plus
  2. Subscribe to our email updates: Sign Up Now
  3. Get your own self-hosted blog with a Free Domain at ($3.45/month).
  4. Become a Supporter – Make a contribution via PayPal
  5. Support us by purchasing our premium books in PDF format.
  6. Support us by taking our online Linux courses

We are thankful for your never ending support.

View all Posts

Aaron Kili

Aaron Kili is a Linux and F.O.S.S enthusiast, an upcoming Linux SysAdmin, web developer, and currently a content creator for TecMint who loves working with computers and strongly believes in sharing knowledge.

Your name can also be listed here. Got a tip? Submit it here to become an TecMint author.

Source

Germany Dedicated Server

Red Hat underpins the growing importance of Linux and open source

Red Hat’s new vice president and general manager of its RHEL Business Unit, Stefanie Chiras, enthusiastically embraces the growing importance of Linux.

20151027 red hat logo

Stephen Lawson/IDG

“);
});
try {
$(“div.lazyload_blox_ad”).lazyLoadAd({
threshold : 0, // You can set threshold on how close to the edge ad should come before it is loaded. Default is 0 (when it is visible).
forceLoad : false, // Ad is loaded even if not visible. Default is false.
onLoad : false, // Callback function on call ad loading
onComplete : false, // Callback function when load is loaded
timeout : 1500, // Timeout ad load
debug : false, // For debug use : draw colors border depends on load status
xray : false // For debug use : display a complete page view with ad placements
}) ;
}
catch (exception){
console.log(“error loading lazyload_ad ” + exception);
}
});

While you may not spend a lot of time thinking about this, the role Linux plays in the technology that we all use everyday is growing quite significantly. In an effort to more fully appreciate this, I had an opportunity to speak with the new vice resident and general manager of Red Hat’s RHEL Business Unit — Dr. Stefanie Chiras — and ask about her vision for RHEL and Linux in general. She was very enthusiastic — not just for Red Hat, but for the open source movement overall and the rising importance of Linux.

Chiras started with Red Hat in July — not quite four months ago — and already describes herself as a “true Red Hatter.” She explained that she has had a serious focus on Linux for the last six years or more. As she points out, we all do development differently these days because of the open source movement. The changes in just the last five years have moved us to very different ways of doing things whether we’re working on public or private clouds, containers, or bare metal.

During the interview, I learned to properly pronounce “RHEL,” which I’d in the past always expanded to its full name (Red Hat Enterprise Linux). Chiras — and probably everyone else at Red Hat — simply says “rel” as in the beginning of “relevant.”

Chiras was most excited about joining Red Hat at what she sees as a pivotal point with Linux providing greater stability and security and the rapid current of innovation. Developers are increasingly turning to Linux for rapid deployment, using tools such as OpenShift for rapid delivery.

Linux is everywhere

Linux is playing an increasingly important role in all of our lives. In fact, it has become one of the most important pieces of computer software in the world. Even those of us who don’t own or manage Linux systems probably use it every day — on our phones and tablets, through the web pages that we frequent, when we check our friends’ Facebook pages, when we find our way to websites using Google, or when we research topics on Wikipedia. Those of us who manage Linux systems have probably noticed that we’re not so much the oddballs on the tech staff that we were five or 10 years ago. The systems we set up and manage are moving to the mainstream and providing more important services than they ever did in the past.

What the increase in Linux means to us

Linux skills are increasingly valuable. Regardless of the technology in use, the OS is just as important as ever — on every platform and not at all diminished.

How everything comes together is vital and exciting. Open source and Linux in particular have dramatically changed the computing world and brought us to an increasingly flexible, powerful, and fast moving technological landing pad. Developers and Linux professionals are as important as ever. Put on your seat belts, and try to keep up. We’re all going places, and the technology that’s moving us forward is very exciting.

Join the Network World communities on

Facebook

and

LinkedIn

to comment on topics that are top of mind.

Sandra Henry-Stocker has been administering Unix systems for more than 30 years. She describes herself as “USL” (Unix as a second language) but remembers enough English to write books and buy groceries. She lives in the mountains in Virginia where, when not working with or writing about Unix, she’s chasing the bears away from her bird feeders.

Source

Germany Dedicated Server

Install WordPress 5 with Apache, MariaDB 10 and PHP 7 on CentOS 7

by Ravi Saive | Published: March 11, 2019 |
Last Updated: March 11, 2019

‘,
enableHover: false,
enableTracking: true,
buttons: { twitter: },
click: function(api, options){
api.simulateClick();
api.openPopup(‘twitter’);
}
});
jQuery(‘#facebook’).sharrre({
share: {
facebook: true
},
template: ‘

‘,
enableHover: false,
enableTracking: true,
click: function(api, options){
api.simulateClick();
api.openPopup(‘facebook’);
}
});
jQuery(‘#googleplus’).sharrre({
share: {
googlePlus: true
},
template: ‘

‘,
enableHover: false,
enableTracking: true,
urlCurl: ‘https://www.tecmint.com/wp-content/themes/tecmint/js/sharrre.php’,
click: function(api, options){
api.simulateClick();
api.openPopup(‘googlePlus’);
}
});
jQuery(‘#linkedin’).sharrre({
share: {
linkedin: true
},
template: ‘

‘,
enableHover: false,
enableTracking: true,
buttons: {
linkedin: {
description: ‘Install WordPress 5 with Apache, MariaDB 10 and PHP 7 on CentOS 7’,media: ‘https://www.tecmint.com/wp-content/uploads/2016/05/Install-WordPress-on-CentOS-Apache.jpg’ }
},
click: function(api, options){
api.simulateClick();
api.openPopup(‘linkedin’);
}
});
// Scrollable sharrre bar, contributed by Erik Frye. Awesome!
var shareContainer = jQuery(“.sharrre-container”),
header = jQuery(‘#header’),
postEntry = jQuery(‘.entry’),
$window = jQuery(window),
distanceFromTop = 20,
startSharePosition = shareContainer.offset(),
contentBottom = postEntry.offset().top + postEntry.outerHeight(),
topOfTemplate = header.offset().top;
getTopSpacing();
shareScroll = function(){
if($window.width() > 719){
var scrollTop = $window.scrollTop() + topOfTemplate,
stopLocation = contentBottom – (shareContainer.outerHeight() + topSpacing);
if(scrollTop > stopLocation){
shareContainer.offset();
}
else if(scrollTop >= postEntry.offset().top-topSpacing){
shareContainer.offset();
}else if(scrollTop 1024)
topSpacing = distanceFromTop + jQuery(‘.nav-wrap’).outerHeight();
else
topSpacing = distanceFromTop;
}
});

If You Appreciate What We Do Here On TecMint, You Should Consider:

  1. Stay Connected to: Twitter | Facebook | Google Plus
  2. Subscribe to our email updates: Sign Up Now
  3. Get your own self-hosted blog with a Free Domain at ($3.45/month).
  4. Become a Supporter – Make a contribution via PayPal
  5. Support us by purchasing our premium books in PDF format.
  6. Support us by taking our online Linux courses

We are thankful for your never ending support.

View all Posts

Ravi Saive

I am Ravi Saive, creator of TecMint. A Computer Geek and Linux Guru who loves to share tricks and tips on Internet. Most Of My Servers runs on Open Source Platform called Linux. Follow Me: Twitter, Facebook and Google+

Your name can also be listed here. Got a tip? Submit it here to become an TecMint author.

Source

Germany Dedicated Server

How to create portable documents with CBZ and DjVu

Recently, I discovered that my great-great-grandfather wrote two books near the turn of the 20th century: one about sailing and the other about his career as New York City’s fire chief. The books have a niche audience, but since they are part of my family history, I wanted to preserve a digital copy of each. But, I wondered, what portable document format is best suited for such an endeavor?

I decided early on that PDF was not an option. The format, while good for printing preflight, seems condemned to nonstop feature bloat, and it produces documents that are difficult to introspect and edit. I wanted a smarter format with similar features. Two came to mind: comic book archive and DjVu.

Comic book archive

Comic book archive is a simple format most often used, as the name suggests, for comic books. You can see examples of comic book archives on sites like Comic Book Plus and The Digital Comic Museum.

The greatest feature of a comic book archive is also its weakest: it’s so simple, it’s almost more of a convention than a format. In fact, a comic book archive is just a ZIP, TAR, 7Z, or RAR archive given the extension .cbz, .cbt, .cb7, or .cbr, respectively. It has no standard for storing metadata.

They are, however, very easy to create.

Creating comic book archives

  1. Create a directory full of image files, and rename the images so that they have an inherent order:
    $ n=0 && for i in *.png ; do mv $i `printf %04d $n`.png ; done
  1. Archive the files using your favorite archive tool. In my experience, CBZ is best supported.
    $ zip comicbook.zip -r *.png
  1. Finally, rename the file with the appropriate extension.
    $ mv comicbook.zip comicbook.cbz

The resulting file should open on most of your devices. On Linux, both Evince and Okular can open CBZ files. On Android, Document Viewer and Bubble can open them.

Uncompressing comic book archives

Getting your data back out of a comic book archive is also easy: just unarchive the CBZ file.

Since your favorite archive tool may not recognize the .cbz extension as a valid archive, it’s best to rename it back to its native extension:

$ mv comicbook.cbz comicbook.zip
$ unzip comicbook.zip

DjVu

A more advanced format, developed more than 20 years ago by AT&T, is DjVu (pronounced “déjà vu”). It’s a digital document format with advanced compression technology and is viewable in more applications than you probably realize, including Evince, Okular, DjVu.js online, the DjVu.js viewer Firefox extension, GNU Emacs, Document Viewer on Android, and the open source, cross-platform DjView viewer on Sourceforge.

You can read more about DjVu and find sample .djvu files, at djvu.org.

DjVu has several appealing features, including image compression, outline (bookmark) structure, and support for embedded text. It’s easy to introspect and edit using free and open source tools.

Installing DjVu

The open source toolchain is DjVuLibre, which you can find in your distribution’s software repository. For example, on Fedora:

$ sudo dnf install dvjulibre

Creating a DjVu file

A .djvu is an image that has been encoded as a DjVu file. A .djvu can contain one or more images (stored as “pages”).

To manually produce a DjVu, you can use one of two encoders: c44 for high-quality images or cjb2 for simple bi-tonal images. Each encoder accepts a different image format: c44 can process .pnm or .jpeg files, while cjb2 can process .pbm or .tiff images.

If you need to preprocess an image, you can do that in a terminal with Image Magick, using the -density option to define your desired resolution:

$ convert -density 200 foo.png foo.pnm

Then you can convert it to DjVu:

$ c44 -dpi 200 foo.pnm foo.djvu

If your image is simple, like black text on a white page, you can try to convert it using the simpler encoder. If necessary, use Image Magick first to convert it to a compatible intermediate format:

$ convert -density 200 foo.png foo.pbm

And then convert it to DjVu:

$ cjb2 -dpi 200 foo.pbm foo.djvu

You now have a simple, single-page .djvu document.

Creating a multi-page DjVu file

While a single-page DjVu can be useful, given DjVu’s sometimes excellent compression, it’s most commonly used as a multi-page format.

Assuming you have a directory of many .djvu files, you can bundle them together with the djvm command:

$ djvm -c pg_1.djvu two.djvu 003.djvu mybook.djvu

Unlike a CBZ archive, the names of the bundled images have no effect on their order in the DjVu document, rather it preserves the order you provide in the command. If you had the foresight to name them in a natural sorting order (001.djvu, 002.djvu, 003.djvu, 004.djvu, and so on), you can use a wildcard:

$ djvm -c *.djvu mybook.djvu

Manipulating a DjVu document

It’s easy to edit DjVu documents with djvm. For instance, you can insert a page into an existing DjVu document:

$ djvm -i mybook.djvu newpage.djvu 2

In this example, the page newpage.djvu becomes the new page 2 in the file mybook.djvu.

You can also delete a page. For example, to delete page 4 from mybook.djvu:

$ djvm -d mybook.djvu 4

Setting an outline

You can add metadata to a DjVu file, such as an outline (commonly called “bookmarks”). To do this manually, create a plaintext file with the document’s outline. A DjVu outline is expressed in a Lisp-like structure, with an opening bookmarks element followed by bookmark names and page numbers:

(bookmarks
(“Front cover” “#1”)
(“Chapter 1” “#3”)
(“Chapter 2” “#18”)
(“Chapter 3” “#26”)
)

The parentheses define levels in the outline. The outline currently has only top-level bookmarks, but any section can have a subsection by delaying its closing parenthesis. For example, to add a subsection to Chapter 1:

(bookmarks
(“Front cover” “#1”)
(“Chapter 1” “#3”
(“Section 1” “#6”))
(“Chapter 2” “#18”)
(“Chapter 3” “#26”)
)

Once the outline is complete, save the file and apply it to your DjVu file using the djvused command:

$ djvused -e ‘set-outline outline.txt’ -s mybook.djvu

Open the DjVu file to see the outline.

Embedding text

If you want to store the text of a document you’re creating, you can embed text elements (“hidden text” in djvused terminology) in your DjVu file so that applications like Okular or DjView can select and copy the text to a user’s clipboard.

This is a complex operation because, in order to embed text, you must first have text. If you have access to a good OCR application (or the time and dedication to transcribe the printed page), you may have that data, but then you must map the text to the bitmap image.

Once you have the text and the coordinates for each line (or, if you prefer, for each word), you can write a djvused script with blocks for each page:

select; remove-ant; remove-txt
# ————————-
select “p0004.djvu” # page 4
set-txt
(page 0 0 2550 3300
(line 1661 2337 2235 2369 “Fires and Fire-fighters”)
(line 1761 2337 2235 2369 “by John Kenlon”))

.
# ————————-
select “p0005.djvu” # page 5
set-txt
(page 0 0 2550 3300
(line 294 2602 1206 2642 “Some more text here, blah blah blah.”))

The integers for each line represent the minimum and maximum locations for the X and Y coordinates of each line (xmin, ymin, xmax, ymax). Each line is a rectangle measured in pixels, with an origin at the bottom-left corner of the page.

You can define embedded text elements as words, lines, and hyperlinks, and you can map complex regions with shapes other than just rectangles. You can also embed specially defined metadata, such as BibTex keys, which are expressed in lowercase (year, booktitle, editor, author, and so on), and DocInfo keys, borrowed from the PDF spec, always starting with an uppercase letter (Title, Author, Subject, Creator, Produced, CreationDate, ModDate, and so on).

Automating DjVu creation

While it’s nice to be able to handcraft a finely detailed DjVu document, if you adopt DjVu as an everyday format, you’ll notice that your applications lack some of the conveniences available in the more ubiquitous PDF. For instance, few (if any) applications offer a convenient Print to DjVu or Export to DjVu option, as they do for PDF.

However, you can still use DjVu by leveraging PDF as an intermediate format.

Unfortunately, the library required for easy, automated DjVu conversion is licensed under the CPL, which has requirements that cannot be satisfied by the GPL code in the toolchain. For this reason, it can’t be distributed as a compiled library, but you’re free to compile it yourself.

The process is relatively simple due to an excellent build script provided by the DjVuLibre team.

  1. First, prepare your system with software development tools. On Fedora, the quick-and-easy way is with a DNF group:
    $ sudo dnf group install @c-development
    On Ubuntu:

    $ sudo apt-get install build-essential

  1. Next, download the GSDjVu source code from Sourceforge. Be sure to download GSDjVu, not DjVuLibre (in other words, don’t click on the big green button at the top of the file listing, but on the latest file instead).
  1. Unarchive the file you just downloaded, and change directory into it:

    $ cd ~/Downloads
    $ tar xvf gsdjvu-X.YY.tar.gz
    $ cd gsdjvu-X.YY

  1. Create a directory called BUILD. It must be called BUILD, so quell your creativity:
  1. Download the additional source packages required to build the GSDjVu application. Specifically, you must download the source for Ghostscript (you almost certainly already have this installed, but you need its source to build against). Additionally, your system must have source packages for jpeg, libpng, openjpeg, and zlib. If you think your system already has the source packages for these projects, you can run the build script; if the sources are not found, the script will fail and let you correct the error before trying again.
  1. Run the interactive build-gsdjvu build script included in the download. This script unpacks the source files, patches Ghostscript with the gdevdjvu driver, compiles Ghostscript, and prunes unnecessary files from the build results.
  1. You can install GSDjVu anywhere in your path. If you don’t know what your PATH variable is, you can see it with echo $PATH. For example, to install it to the /usr/local prefix:

    $ sudo cp -r BUILD/INST/gsdjvu /usr/local/lib64
    $ cd /usr/local/bin
    $ sudo ln -s ../lib64/gsdjvu/gsdjvu gsdjvu

Converting a PDF to DjVu

Now that you’ve built the Ghostscript driver, converting a PDF to DjVu requires just one command:

$ djvudigital –words mydocument.pdf mydocument.djvu

This transforms all pages, bookmarks, and embedded text in a PDF into a DjVu file. The –words option maps all mapped embedded PDF text to the corresponding points in the DjVu file. If there is no embedded PDF, then no embedded text is carried over. Using this tool, you can use convenient PDF functions from your applications and end up with DjVu files.

Why DjVu and CBZ?

DjVu and comic book archive are great additional document formats for your archival arsenal. It seems silly to stuff a series of images into a PostScript format, like PDF, or a format clearly meant mostly for text, like EPUB, so it’s nice to have CBZ and DjVu as additional options. They might not be right for all of your documents, but it’s good to get comfortable with them so you can use one when it makes the most sense.

Source

Germany Dedicated Server

How to Generate a CSR (Certificate Signing Request) in Linux

by Aaron Kili | Published: March 12, 2019 |

March 12, 2019

‘,
enableHover: false,
enableTracking: true,
buttons: { twitter: },
click: function(api, options){
api.simulateClick();
api.openPopup(‘twitter’);
}
});
jQuery(‘#facebook’).sharrre({
share: {
facebook: true
},
template: ‘

‘,
enableHover: false,
enableTracking: true,
click: function(api, options){
api.simulateClick();
api.openPopup(‘facebook’);
}
});
jQuery(‘#googleplus’).sharrre({
share: {
googlePlus: true
},
template: ‘

‘,
enableHover: false,
enableTracking: true,
urlCurl: ‘https://www.tecmint.com/wp-content/themes/tecmint/js/sharrre.php’,
click: function(api, options){
api.simulateClick();
api.openPopup(‘googlePlus’);
}
});
jQuery(‘#linkedin’).sharrre({
share: {
linkedin: true
},
template: ‘

‘,
enableHover: false,
enableTracking: true,
buttons: {
linkedin: {
description: ‘How to Generate a CSR (Certificate Signing Request) in Linux’,media: ‘https://www.tecmint.com/wp-content/uploads/2019/03/Generate-CSR-Certificate-in-Linux.png’ }
},
click: function(api, options){
api.simulateClick();
api.openPopup(‘linkedin’);
}
});
// Scrollable sharrre bar, contributed by Erik Frye. Awesome!
var shareContainer = jQuery(“.sharrre-container”),
header = jQuery(‘#header’),
postEntry = jQuery(‘.entry’),
$window = jQuery(window),
distanceFromTop = 20,
startSharePosition = shareContainer.offset(),
contentBottom = postEntry.offset().top + postEntry.outerHeight(),
topOfTemplate = header.offset().top;
getTopSpacing();
shareScroll = function(){
if($window.width() > 719){
var scrollTop = $window.scrollTop() + topOfTemplate,
stopLocation = contentBottom – (shareContainer.outerHeight() + topSpacing);
if(scrollTop > stopLocation){
shareContainer.offset();
}
else if(scrollTop >= postEntry.offset().top-topSpacing){
shareContainer.offset();
}else if(scrollTop 1024)
topSpacing = distanceFromTop + jQuery(‘.nav-wrap’).outerHeight();
else
topSpacing = distanceFromTop;
}
});

If You Appreciate What We Do Here On TecMint, You Should Consider:

  1. Stay Connected to: Twitter | Facebook | Google Plus
  2. Subscribe to our email updates: Sign Up Now
  3. Get your own self-hosted blog with a Free Domain at ($3.45/month).
  4. Become a Supporter – Make a contribution via PayPal
  5. Support us by purchasing our premium books in PDF format.
  6. Support us by taking our online Linux courses

We are thankful for your never ending support.

View all Posts

Aaron Kili

Aaron Kili is a Linux and F.O.S.S enthusiast, an upcoming Linux SysAdmin, web developer, and currently a content creator for TecMint who loves working with computers and strongly believes in sharing knowledge.

Your name can also be listed here. Got a tip? Submit it here to become an TecMint author.

Source

Germany Dedicated Server

Program the real world using Rust on Raspberry Pi

If you own a Raspberry Pi, chances are you may already have experimented with physical computing—writing code to interact with the real, physical world, like blinking some LEDs or controlling a servo motor. You may also have used GPIO Zero, a Python library that provides a simple interface to GPIO devices from Raspberry Pi with a friendly Python API. GPIO Zero is developed by Opensource.com community moderator Ben Nuttall.

I am working on rust_gpiozero, a port of the awesome GPIO Zero library that uses the Rust programming language. It is still a work in progress, but it already includes some useful components.

Rust is a systems programming language developed at Mozilla. It is focused on performance, reliability, and productivity. The Rust website has great resources if you’d like to learn more about it.

Getting started

Before starting with rust_gpiozero, it’s smart to have a basic grasp of the Rust programming language. I recommend working through at least the first three chapters in The Rust Programming Language book.

I recommend installing Rust on your Raspberry Pi using rustup. Alternatively, you can set up a cross-compilation environment using cross (which works only on an x86_64 Linux host) or this how-to.

After you’ve installed Rust, create a new Rust project by entering:

cargo new rust_gpiozero_demo

Add rust_gpiozero as a dependency (currently in v0.2.0) by adding the following to the dependencies section in your Cargo.toml file

rust_gpiozero = “0.2.0”

Next, blink an LED—the “hello world” of physical computing by modifying the main.rs file with the following:

use rust_gpiozero::*;
use std::thread;
use std::time::Duration;

fn main() {
// Create a new LED attached to Pin 17
let led = LED::new(17);

// Blink the LED 5 times
for _ in 0.. 5{
led.on();
thread::sleep(Duration::from_secs(1));
led.off();
thread::sleep(Duration::from_secs(1));
}
}

rust_gpiozero provides an easier interface for blinking an LED. You can use the blink method, providing the number of seconds it should stay on and off. This simplifies the code to the following:

use rust_gpiozero::*;
fn main() {
// Create a new LED attached to Pin 17
let mut led = LED::new(17);

// on_time = 2 secs, off_time=3 secs
led.blink(2.0,3.0);

// prevent program from exiting immediately
led.wait();
}

Other components

rust_gpiozero provides several components that are similar to GPIO Zero for controlling output and input devices. These include LED, Buzzer, Motor, Pulse Width Modulation LED (PWMLED), Servo, and Button.

Support for other components, sensors, and devices will be added eventually. You can refer to the documentation for further usage information.

More resources

rust_gpiozero is still a work in progress. If you need more resources for getting started with Rust on your Raspberry Pi, here are some useful links:

Raspberry Pi Peripheral Access Library (RPPAL)

Similar to GPIO Zero, which is based on the RPi.GPIO library, rust_gpiozero builds upon the awesome RPPAL library by Rene van der Meer. If you want more control for your projects using Rust, you should definitely try RPPAL. It has support for GPIO, Inter-Integrated Circuit (I2C), hardware and software Pulse Width Modulation (PWM), and Serial Peripheral Interface (SPI). Universal asynchronous receiver-transmitter (UART) support is currently in development.

Sense HAT support

Sensehat-rs is a library by Jonathan Pallant (@therealjpster) that provides Rust support for the Raspberry Pi Sense HAT add-on board. Jonathan also has a starter workshop for using the library and he wrote a beginner’s intro to use Rust on Raspberry Pi, “Read Sense HAT with Rust,” in Issue 73 of The MagPi magazine.

Wrap Up

Hopefully, this has inspired you to use the Rust programming language for physical computing on your Raspberry Pi. rust_gpiozero is a library which provides useful components such as LED, Buzzer, Motor, PWMLED, Servo, and Button. More features are planned and you can follow me on twitter or check out my blog to stay tuned.

Source

Germany Dedicated Server

Why Linux System Administrators Need Programming Skills

by Aaron Kili | Published: March 13, 2019 |

March 13, 2019

‘,
enableHover: false,
enableTracking: true,
buttons: { twitter: },
click: function(api, options){
api.simulateClick();
api.openPopup(‘twitter’);
}
});
jQuery(‘#facebook’).sharrre({
share: {
facebook: true
},
template: ‘

‘,
enableHover: false,
enableTracking: true,
click: function(api, options){
api.simulateClick();
api.openPopup(‘facebook’);
}
});
jQuery(‘#googleplus’).sharrre({
share: {
googlePlus: true
},
template: ‘

‘,
enableHover: false,
enableTracking: true,
urlCurl: ‘https://www.tecmint.com/wp-content/themes/tecmint/js/sharrre.php’,
click: function(api, options){
api.simulateClick();
api.openPopup(‘googlePlus’);
}
});
jQuery(‘#linkedin’).sharrre({
share: {
linkedin: true
},
template: ‘

‘,
enableHover: false,
enableTracking: true,
buttons: {
linkedin: {
description: ‘Why Linux System Administrators Need Programming Skills’,media: ‘https://www.tecmint.com/wp-content/uploads/2019/03/Why-Linux-System-Administrators-Need-Programming-Skills.jpg’ }
},
click: function(api, options){
api.simulateClick();
api.openPopup(‘linkedin’);
}
});
// Scrollable sharrre bar, contributed by Erik Frye. Awesome!
var shareContainer = jQuery(“.sharrre-container”),
header = jQuery(‘#header’),
postEntry = jQuery(‘.entry’),
$window = jQuery(window),
distanceFromTop = 20,
startSharePosition = shareContainer.offset(),
contentBottom = postEntry.offset().top + postEntry.outerHeight(),
topOfTemplate = header.offset().top;
getTopSpacing();
shareScroll = function(){
if($window.width() > 719){
var scrollTop = $window.scrollTop() + topOfTemplate,
stopLocation = contentBottom – (shareContainer.outerHeight() + topSpacing);
if(scrollTop > stopLocation){
shareContainer.offset();
}
else if(scrollTop >= postEntry.offset().top-topSpacing){
shareContainer.offset();
}else if(scrollTop 1024)
topSpacing = distanceFromTop + jQuery(‘.nav-wrap’).outerHeight();
else
topSpacing = distanceFromTop;
}
});

If You Appreciate What We Do Here On TecMint, You Should Consider:

  1. Stay Connected to: Twitter | Facebook | Google Plus
  2. Subscribe to our email updates: Sign Up Now
  3. Get your own self-hosted blog with a Free Domain at ($3.45/month).
  4. Become a Supporter – Make a contribution via PayPal
  5. Support us by purchasing our premium books in PDF format.
  6. Support us by taking our online Linux courses

We are thankful for your never ending support.

View all Posts

Aaron Kili

Aaron Kili is a Linux and F.O.S.S enthusiast, an upcoming Linux SysAdmin, web developer, and currently a content creator for TecMint who loves working with computers and strongly believes in sharing knowledge.

Your name can also be listed here. Got a tip? Submit it here to become an TecMint author.

Source

Germany Dedicated Server