The 6 Best Linux Distros for Network Engineers

https://static1.makeuseofimages.com/wordpress/wp-content/uploads/2023/06/man-works-on-laptop-next-to-networking-equipment.jpg

Linux is commonly preferred among network engineers—so if you’ve thought about installing it for your work, you’re not alone.

MUO video of the day

SCROLL TO CONTINUE WITH CONTENT

If you’re a network engineer, it’s easy to wonder which distributions will have the best features for your work. Here are the six best Linux distributions for network engineering:

1. Fedora

Of all the Linux distributions, one of the most highly regarded among network engineers is Fedora—and there’s a simple reason why.

Fedora is an open-source distribution that serves as a community equivalent to Red Hat Enterprise Linux (RHEL). RHEL itself is commonly chosen as the operating system for enterprise-level systems.

As a result, network engineers who use Fedora enjoy a greater level of familiarity with the RHEL systems they may encounter throughout their careers.

Fedora also offers users an incredible arsenal of open-source tools, built-in support for containerized applications, and consistent access to cutting-edge features and software.

Download: Fedora (free)

2. RHEL

rhel 9 desktop view
Image Credit: RedHat/Wikimedia under CC BY-SA 4.0

As one of the most popular enterprise distributions, RHEL is a great option because it is robust and reinforced. Each version of RHEL has a 10-year lifecycle, meaning that you’ll be able to use your chosen version of RHEL (and enjoy little to no compatibility issues) for years.

By using RHEL, you’ll also become familiar with many of the systems you’re likely to encounter on the job.

Many of the qualities of RHEL that make it attractive as an enterprise solution are just as appealing for independent users.

RHEL comes pre-equipped with the SELinux security module, so you will find it easy to get started with managing access controls and system policies. You’ll also have access to tools like Cacti and Snort through the RPM and YUM package managers.

Download: RHEL (free for developers; $179 annually)

3. CentOS Stream

Much like Fedora, CentOS Stream is a distribution that stays in line with the development of RHEL. It serves as the upstream edition of RHEL, meaning that the content in the latest edition of CentOS Stream is likely to appear in RHEL’s next release.

While CentOS Stream may not offer the same stability as Fedora, its enticing inclusion of cutting-edge software makes it worth considering.

CentOS Stream also has a distinct advantage over downstream editions of RHEL following Red Hat’s decision to close public access to the source code of RHEL: it will continue to stay in line with the latest experimental changes considered for the next release of RHEL.

In the future, CentOS Stream is likely to become the best option for anyone seeking an RHEL-adjacent distribution.

Download: CentOS Stream (free)

4. openSUSE

Another powerful and reliable option for network engineers is openSUSE. openSUSE is impressively stable and offers frequent new releases, making it a good option if you prefer to avoid broken packages while still taking advantage of the latest software releases.

Out of the box, you won’t have any issues configuring basic network settings through YaST (Yet another Setup Tool). Many of the packages that come preinstalled with openSUSE can provide you with incredible utility.

Wicked is a powerful network configuration framework, for example, while Samba is perfect for enabling file-sharing between Linux and Windows systems. You won’t have any trouble installing the right tool for a job with openSUSE’s Zypper package manager.

Download: openSUSE (free)

5. Debian

viewing settings and browser in debian
Image Credit: Граймс/Wikimedia under CC BY-SA 4.0

Debian is a widely-renowned Linux distribution known for being incredibly stable and high-performance. Several branches of Debian are available, including Debian Stable (which is extremely secure and prioritizes stability) and Debian Unstable (which is more likely to break but provides access to the newest cutting-edge releases of software).

One of the biggest advantages of using Debian for network engineering is that it has an incredible package-rich repository with over 59,000 different software packages.

If you’re interested in trying out the newest niche and experimental tools in networking and cybersecurity, an installation of Debian will provide you with total access.

Download: Debian (free)

6. Kali Linux

kali desktop view
Image Credit: Gased Basek/Wikimedia under CC BY-SA 4.0

As a distribution designed for penetration testing, Kali Linux comes with a massive variety of preinstalled tools that network engineers are certain to find useful. Wireshark offers tantalizing information about packets moving across a network, Nmap provides useful clues about network security, and SmokePing provides interesting visualizations of network latency.

Not all of the software packaged with Kali Linux is useful for network engineers, but luckily, new Kali installations are completely customizable. You should plan out what packages you intend to use in advance so that you can avoid installing useless packages and keep your Kali system minimally cluttered.

Download: Kali Linux (free)

Familiarize Yourself With Your New Networking Distro

While some Linux distributions are better suited to network engineers, almost any Linux distribution can be used with the right software and configurations.

You should test out software like Nmap and familiarize yourself with networking on your new Linux distro so that lack of familiarity doesn’t become an obstacle later on.

MakeUseOf

Laravel Migrations: “Table already exists” After Foreign Key Failed

https://laraveldaily.com/storage/437/Copy-of-Copy-of-Copy-of-ModelpreventLazyLoading();-(4).png

If you create foreign keys in your migrations, there may be a situation that the table is created successfully, but the foreign key fails. Then your migration is “half successful”, and if you re-run it after the fix, it will say “Table already exists”. What to do?


The Problem: Explained

First, let me explain the problem in detail. Here’s an example.

Schema::create('teams', function (Blueprint $table) {

$table->id();

$table->string('name');

$table->foreignId('team_league_id')->constrained();

$table->timestamps();

});

The code looks good, right? Now, what if the referenced table “team_leagues” doesn’t exist? Or maybe it’s called differently? Then you will see this error in the Terminal:

2023_06_05_143926_create_teams_table ..................................................................... 20ms FAIL

 

Illuminate\Database\QueryException

 

SQLSTATE[HY000]: General error: 1824 Failed to open the referenced table 'team_leagues'

(Connection: mysql, SQL: alter table `teams` add constraint `teams_team_league_id_foreign` foreign key (`team_league_id`) references `team_leagues` (`id`))

But that is only part of the problem. So ok, you realized that the referenced table is called “leagues” and not “team_leagues”. Possible fix options:

  • Either rename the field of “team_league_id” to just “league_id”
  • Or, specify the table ->constrained('leagues')

But the real problem now is the state of the database:

  • The table teams is already created
  • But the foreign key to leagues has failed!

This means there’s no record of this migration success in the “migrations” Laravel system DB table.

Now, the real problem: if you fix the error in the same migration and just run php artisan migrate, it will say, “Table already exists”.

2023_06_05_143926_create_teams_table ...................................................................... 3ms FAIL

 

Illuminate\Database\QueryException

 

SQLSTATE[42S01]: Base table or view already exists:

1050 Table 'teams' already exists

(Connection: mysql, SQL: create table `teams` (...)

So should you create a new migration? Rollback? Let me explain my favorite way of solving this.


Solution: Schema::hasTable() and Separate Foreign Key

You can re-run the migration for already existing tables and ensure they would be created only if they don’t exist with the Schema::hasTable() method.

But then, we need to split the foreignId() into parts because it’s actually a 2-in-1 method: it creates the column (which succeeded) and the foreign key (which failed).

So, we rewrite the migration into this:

if (! Schema::hasTable('teams')) {

Schema::create('teams', function (Blueprint $table) {

$table->id();

$table->string('name');

$table->unsignedBigInteger('team_league_id');

$table->timestamps();

});

}

 

// This may be in the same migration file or in a separate one

Schema::table('teams', function (Blueprint $table) {

$table->foreign('team_league_id')->constrained('leagues');

});

Now, if you run php artisan migrate, it will execute the complete migration(s) successfully.

Of course, an alternative solution would be to go and manually delete the teams table via SQL client and re-run the migration with the fix, but you don’t always have access to the database if it’s remote. Also, it’s not ideal to perform any manual operations with the database if you use migrations. It may be ok on your local database, but this solution above would be universal for any local/remote databases.

Laravel News Links

JK Rowling hater demands she performs a sex act on him, but she ruins his life with a tweet instead

https://www.louderwithcrowder.com/media-library/image.png?id=34222424&width=980

JK Rowling has been the head transphobe in charge for quite some time now. You know how leftist sh*tc*nts get when you express a different opinion on them on the internet. They go right to the -isms and -phobias they accuse you of. In Rowling’s case, she also gets people threatening her life. All for the think-crime of, four years ago, defending someone who was fired for saying boys are boys and girls are girls.

If death threats don’t phase her, what do you think her putting her mouth on your weiner is going to do? One loser found this out the hard way and if he has any friends, I hope they’re all laughing at him now.,

So how did things escalate this quickly? It starts with Maya Forstater, the woman who got fired from her job for "’publishing “offensive” tweets questioning government proposals to allow people to self-identify as the opposite sex.’" Defending this woman is what started Rowling on her road to TERFdom. Forstater had just won a settlement when the organisation "was found to have engaged in unlawful discrimination in its decision not to offer her an employment contract or to renew her visiting fellowship."

Turns out that having a common belief about sex and gender does NOT equal bigotry.

Rowling offered Maya her congratulations.

Which led to Joshua D’silva telling Rowlings to suck his dick. This WAS the link to the tweet. It was literally deleted while I was working on this post after Rowling informed the world that D’silva allegedly had a penis so small, it was barely detectable. How embarrassing.

The whole Rowling thing still cracks me up. She is in no way, shape, or form on our side politically AT ALL. When leftists were "resisting" Trump in 2015-16, they would identify themselves as sects from Hogwarts. We would dare them to read another book.

All it took was one tweet and one single opinion for the left to turn on JK Rowling as if she was literally Voldermort. It’s hilarious. Especially knowing Rowling is sleeping on a giant pile of money as she responds. to each of her haters.

><><><><><><

Brodigan is Grand Poobah of this here website and when he isn’t writing words about things enjoys day drinking, pro-wrestling, and country music. You can find him on the Twitter too.

Facebook doesn’t want you reading this post or any others lately. Their algorithm hides our stories and shenanigans as best it can. The best way to stick it to Zuckerface? Bookmark LouderWithCrowder.com and check us out throughout the day! Also, follow us on Instagram and Twitter.

Louder With Crowder

If The Mandalorian Was The A-Team

https://theawesomer.com/photos/2023/06/mandalorian_a_team_t.jpg

If The Mandalorian Was The A-Team

Link

The Mandalorian has some great action. So did The A-Team. So Nebulous Bee thought it would be fun to combine the two. This edit reimagines the credits for the Star Wars series in the style of the 1980s hit series, with Bo-Katan, Paz Vizsla, The Armorer, and Din Djarin standing in for Templeton Peck  B.A. Baracus, Hannibal Smith, and Howling Mad Murdock.

The Awesomer

The implications of this technology are staggering

http://img.youtube.com/vi/vSPhhw-2ShI/0.jpg

 

I was astonished to read of the wide-ranging implications of a new laser weeding technology now available to farmers.

Carbon Robotics is now shipping its LaserWeeder to farms around the United States; the machine uses the power of lasers and robotics to rid fields of weeds … The LaserWeeder can eliminate over 200,000 weeds per hour and offer up to 80% cost savings in weed control. 

. . .

The LaserWeeder is a 20-foot-wide unit comprised of three rows of 10 lasers that are pulled behind a tractor.

Thirty lasers are at work as the unit travels across a field destroying weeds "with millimeter accuracy, skipping the plant and killing the weed," said Mikesell. 

The LaserWeeder "does the equivalent work of about 70 people," he continued.

. . .

The technology "makes for a much more consistent growing process and adds a bunch of health to your yield. You get big yield improvements because you’re not damaging the crops with herbicides."

There’s more at the link.

Here’s a publicity video from Carbon Robotics showing the LaserWeeder in action.

The economic implications for farmers and farm workers are mind-boggling.

  • The workers normally hired to manage weeds in crops won’t be needed any more – or, at any rate, far fewer of them.  That’s a huge money-saver for farmers, but how many workers will end up unemployed, with no jobs available to replace those they’ve lost?  What will that do to the unemployment rate overall?
  • I’ve no idea how much per acre farmers normally spend on herbicides, but it’s got to add up.  It probably varies from region to region.  If those expenses are no longer needed, the robotic/laser technology of the LaserWeeder becomes that much more affordable.
  • What will this mean for fertilizers and other input costs?  If crops are no longer threatened by weed incursion, will farmers still need as much fertilizer to obtain high yields, or will the absence of weeds – and the saving of time and money through not having to fight them – mean that less fertilizer can be used, because overall crop productivity will be higher even without it?
  • Can this technology be scaled according to the size of farm and type of crop?  The video above shows a big machine in a big field.  Can a smaller machine be made at a lower cost?  Can smaller farms use it cost-effectively?  Can the technology be adapted to (say) market gardening in greenhouses, rather than fields?  These things may not be possible now, but if they become feasible, they may make even the small-scale, backyard growing of fruit and vegetables much easier and cheaper.  Might we be able to grow a certain proportion of our own food, more practically and affordably than before, thereby reducing our dependence on "Big Ag"?
  • Do these input cost savings mean that farmers (and Big Ag in particular) can/will accept lower prices for their produce, because they’ll have lower input costs to grow them?
  • Can this technology be adapted to (say) gardening in greenhouses and back yards, rather than larger fields?  It may not be possible now, but if it becomes feasible, it may make the small-scale, private cultivation of fruit and vegetables much easier and cheaper.  You might see groups of neighbors hiring or buying such technology to share among themselves, at home or in allotments.
  • Over time, this technology may revolutionize the production of food, thereby addressing some of the "woke" or "green" concerns about modern farming practices.  There’s a lot of concern about the over-use of farm chemicals and resultant pollution problems (see, for example, the so-called "dead zone" in the Gulf of Mexico, caused by such chemicals draining down the Mississippi River and out to sea).  Could such technology help reduce that problem, by needing less fertilizer and/or herbicides?

Just the thought of no longer having to spend hours weeding in the back yard is enormously tempting.  This will bear watching.

Peter

Bayou Renaissance Man

This Rig Turns Walls/Windows Into Animated Lite-Brites

https://s3files.core77.com/blog/images/1414093_81_124043_JrOgOXAJJ.jpg

Interior/exterior decoration, 2020s-style: Govee Curtain Lights are essentially a curtain of hanging LED-embedded strips. Measuring 1.5m (5′) wide and 2m (6.6′) tall, this provides a grid of 520 evenly-spaced LEDs that you can program via an app, allowing you to turn walls or windows into gigantic animated Lite-Brites.

You can either choose from stock animations provided by the company, or create your own. The company also boasts of a "Music Mode" that makes the lights move in accordance with music.

If this is your jam, startup Govee paid the YouTuber below to produce this video on setting up and using the product.

All I can think is how dated this is going to look in a few years; I imagine if this style of decoration catches on, the consumer will demand a much higher level of resolution.

Core77

Data School: Make your own *private* GPT with Python 🔒

https://www.dataschool.io/content/images/2023/06/ai.jpegMake your own *private* GPT with Python ????

ChatGPT is amazing, but its knowledge is limited to the data on which it was trained.

Wouldn&apost it be great if you could use the power of Large Language Models (LLMs) to interact with your own private documents, without uploading them to the web?

The great news is that you can do this TODAY! Let me show you how…

privateGPT is an open source project that allows you to parse your own documents and interact with them using a LLM. You ask it questions, and the LLM will generate answers from your documents.

All using Python, all 100% private, all 100% free!

Below, I&aposll walk you through how to set it up. (Note that this will require some familiarity with the command line.)


1️⃣ Clone or download the repository

If git is installed on your computer, then navigate to an appropriate folder (perhaps "Documents") and clone the repository (git clone https://github.com/imartinez/privateGPT.git). That will create a "privateGPT" folder, so change into that folder (cd privateGPT).

Alternatively, you could download the repository as a zip file (using the green "Code" button), move the zip file to an appropriate folder, and then unzip it. It will create a folder called "privateGPT-main", which you should rename to "privateGPT". You&aposll then need to navigate to that folder using the command line.


2️⃣ Create and activate a new environment

I highly recommend setting up a virtual environment for this project. My tool of choice is conda, which is available through Anaconda (the full distribution) or Miniconda (a minimal installer), though many other tools are available.

If you&aposre using conda, create an environment called "gpt" that includes the latest version of Python using conda create -n gpt python. Then, activate the environment using conda activate gpt. Use conda list to see which packages are installed in this environment.

(Note: privateGPT requires Python 3.10 or later.)


3️⃣ Install the packages listed in requirements.txt

First, make sure that "privateGPT" is your working directory using pwd. Then, make sure that "gpt" is your active environment using conda info.

Once you&aposve done that, use pip3 install -r requirements.txt to install all of the packages listed in that file into the "gpt" environment. This will take at least a few minutes.

Use conda list to see the updated list of which packages are installed.

(Note: The System Requirements section of the README may be helpful if you run into an installation error.)


4️⃣ Download the LLM model

In the Environment Setup section of the README, there&aposs a link to an LLM. Currently, that LLM is ggml-gpt4all-j-v1.3-groovy.bin. Download that file (3.5 GB).

Then, create a subfolder of the "privateGPT" folder called "models", and move the downloaded LLM file to "models".


5️⃣ Copy the environment file

In the "privateGPT" folder, there&aposs a file named "example.env". Make a copy of that file named ".env" using cp example.env .env. Use ls -a to check that it worked.

(Note: This file has nothing to do with your virtual environment.)


6️⃣ Add your documents

Add your private documents to the "source_documents" folder, which is a subfolder of the "privateGPT" folder. Here&aposs a list of the supported file types.

I recommend starting with a small number of documents so that you can quickly verify that the entire process works. (The "source_documents" folder already contains a sample document, "state_of_the_union.txt", so you can actually just start with this document if you like.)


7️⃣ Ingest your documents

Once again, make sure that "privateGPT" is your working directory using pwd.

Then, run python ingest.py to parse the documents. This may run quickly (< 1 minute) if you only added a few small documents, but it can take a very long time with larger documents.

Once this process is done, you&aposll notice that there&aposs a new subfolder of "privateGPT" called "db".


8️⃣ Interact with your documents

Run python privateGPT.py to start querying your documents! Once it has loaded, you will see the text Enter a query:

Type in your question and hit enter. After a minute, it will answer your question, followed by a list of source documents that it used for context.

(Keep in mind that the LLM has "knowledge" far outside your documents, so it can answer questions that have nothing to do with the documents you provided to it.)

When you&aposre done asking questions, just type exit.


???? Troubleshooting

This project is less than two months old, and it depends on other libraries which are also quite new! Thus it&aposs highly likely that you will run into bugs, unexplained errors, and crashes.

For example, if you get an "unknown token" error after asking a question, my experience has been that you can ignore the error and you will still get an answer to your question.

On the other hand, if you get a memory-related error, you will need to end the process by hitting "Ctrl + C" on your keyboard. (Then, just restart it by running python privateGPT.py.)

You might be able to find a workaround to a particular problem by searching the Issues in the privateGPT repository.

If you post your own GitHub issue, please be kind! This is an open source project being run by one person in his spare time (for free)!


???? Usage tips

Want to query more documents? Add them to the "source_documents" folder and re-run python ingest.py.

Want to start over? Delete the "db" folder, and a new "db" folder will be created the next time you ingest documents.

Want to hide the source documents for each answer? Run python privateGPT.py -S instead of python privateGPT.py.

Want to try a different LLM? Download a different LLM to the "models" folder and reference it in the ".env" file.

Want to use the latest version of the code? Given its popularity, it&aposs likely that this project will evolve rapidly. If you want to use the latest version of the code, run git pull origin main.


???? Disclaimer

I think it&aposs worth repeating the disclaimer listed at the bottom of the repository:

This is a test project to validate the feasibility of a fully private solution for question answering using LLMs and Vector embeddings. It is not production-ready, and it is not meant to be used in production. The models selection is not optimized for performance, but for privacy; but it is possible to use different models and vector stores to improve performance.

Planet Python

How to Store JSON Data in Database in Laravel (with example)

https://laracoding.com/wp-content/uploads/2023/06/how-to-store-json-data-in-database-in-laravel-with-example_841.png

Storing JSON data in a Laravel database provides a flexible solution for managing dynamic attributes or unstructured data. In this tutorial, we will walk through the process of storing JSON data in a Laravel database, using a practical example of storing product attributes. By the end of this tutorial, you will have a clear understanding of how to store and retrieve JSON data efficiently using Laravel.

Step 1: Setting up a Laravel Project

Create a new Laravel project using the following command:

laravel new json-data-storage

Step 2: Creating the Products Table Migration

Generate a migration file to create the products table using the command:

php artisan make:migration create_products_table --create=products

Inside the generated migration file (database/migrations/YYYY_MM_DD_create_products_table.php), define the table schema with a JSON column for the attributes:

<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::create('products', function (Blueprint $table) {
            $table->id();
            $table->json('attributes');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('products');
    }
};

Step 3: Running the Migration

Run the migration using the following command:

php artisan migrate

Step 4: Creating the Product Model

Generate a Product model using the command:

php artisan make:model Product

In the Product model (app/Models/Product.php), add the $casts property to specify that the attributes attribute should be treated as JSON:

<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class Product extends Model
{
    use HasFactory;

    protected $casts = [
        'attributes' => 'json',
    ];
}

Step 5: Storing Product Attributes as JSON

To store product attributes as JSON, we can simply use Laravel’s Eloquent model. Create a new Product instance, set the desired attributes as an array, and save it:

use App\Models\Product;

$product = new Product;
$product->attributes = [
    'color' => 'red',
    'size' => 'medium',
    'weight' => 0.5,
];
$product->save();

Step 6: Retrieving JSON Data

To retrieve the attributes of a product, you can access the attributes property on the model:

$product = Product::find(1);
$attributes = $product->attributes;

If you want to access a specific attribute within the JSON data, you can do so by using array access:

$color = $product->attributes['color'];

By accessing the attributes property, you can retrieve the JSON data associated with the product and access specific attributes as needed.

Step 7: Manipulating JSON Data (Full Array)

To update all the attributes of the product at once, you can assign a new array with all the key-value pairs and use Eloquent’s save() method to update the record directly.

$product = \App\Models\Product::find(1);
$product->attributes = [
    'color' => 'green',
    'size' => 'large',
    'weight' => 2.5,
];
$product->save();

Step 8: Manipulating JSON Data (One Value)

Updating a single value within the JSON data requires a slightly different approach in Laravel and has one important caveat. Directly modifying the attribute like $product->attributes['weight'] = 1.0 and saving the product will result in an ErrorException: “Indirect modification of overloaded property App\Models\Product::$attributes has no effect.”

To overcome this issue, you can follow the solution below:

$product = \App\Models\Product::find(1);
$attributes = $product->attributes; // create a copy of the array
$attributes['weight'] = 0.6; // modify the value in the copied array
$product->attributes = $attributes; // assign the copied array back to $product->attributes
$product->save();

Conclusion

Storing JSON data in a database using Laravel provides flexibility and convenience when working with dynamic or unstructured data. By following the steps outlined in this tutorial, you have learned how to create the necessary migrations and models, store and retrieve JSON data, and manipulate the JSON data efficiently. This knowledge equips you with the tools to handle various use cases in your Laravel applications and opens up possibilities for efficiently managing complex data structures.

Start implementing JSON data storage in your Laravel projects and unlock the full potential of your application’s data management capabilities. Happy coding!

Laravel News Links