📜 ⬆️ ⬇️

Script for those who are too lazy to understand Linux

There can be many uses for Linux. Especially when it became possible to rent a VPS from $ 1 per month. In addition to the standard use for hosting sites, it is used as a server for games (CS: GO, Terraria, Minecraft), as a proxy server and VPN server. Under the mining cryptocurrency. Under backup storage. Under the homemade torrent rocking. And also for testing, development and just different experiments. It is the availability of Linux-based VPS with a huge range of possible applications that led to the popularization of Linux. But there are much more people willing to use Linux than people who know how to use it. And often it is the poor knowledge of Linux administration that stops people from using it. Well, or simply complicate life of such people - they have to poke around for hours in manuals, forums and "articles for beginners."

Yes, I myself am tired of climbing specialized forums every time I have to take a step to the left or a step to the right about what I have already learned to do. That is why, over time, I put all the typical things in one script with a friendly interface that can do everything myself. It all started small. The script simply automated the installation of the software I needed. But in six months, it has already become a very serious utility weighing more than 100 Kb, in which there are about 2.5 thousand lines of code. The script has never laid out anywhere before. Used only for personal purposes by me and a few of my comrades. It's time to share it with the public. I'm sure he can save a lot of time for many people.

To understand what he can do, the easiest way is to look at the title screenshot:
')

Further I will describe in more detail what and how he does.

System Information


This section in a friendly form displays information about this server. What kind of hardware, what OS, what IP address. Moreover, he first tries to determine the IP address by interface, but since There are VPS without a dedicated IP address (for NAT), then the script climbs to the Internet and with the help of third-party sites it looks from what IP requests came and shows the real external IP address (it takes a couple of seconds). This information window looks like this:


Work with OS


This section contains a few small utilities, such as changing the root password, setting the time zone, updating the OS, adding a repository, installing popular applications (such as midinght commander), and a few more serious ones, which I’ll dwell on:


Installing the hosting control panel


Linux is often used for hosting, but it’s not easy for newbies to configure all services of the type: Apache, Nginx, PHP, MySQL, mail daemon and so on. Most prefer to install any control panel. But even it must first be somehow installed. In my script, I collected five free site control panels (Vesta CP, Webuzo, CWP, ZPanel, Ajenti) and a paid ISPmanager (which is perhaps the most common panel in Russia). About each panel there is a small description, system requirements. Select the desired panel, the script will download it from the official site (the latest version) and install it.

Work with VPN


Recently, many have turned on VPNs in order to take advantage of users of other geographic areas. For example, bypassing the prohibitions of RosKomNadzor, the use of some domestic American or European services, and so on. Many buy ready-made VPN-services for this. But it is much cheaper to buy a VPS in the right country and raise your own VPN. That's just not everyone can customize it. With this script, you just need to answer the questions and that's it. All necessary software will be installed by itself, the necessary rules will be written in the firewall. You can view, add and delete users who are allowed access. Moreover, the script will analyze what OS you have and will do everything, taking into account the specific features of this particular OS.

Work with proxy


Some people are more accustomed to using proxies instead of VPN. Well, it is often cheaper, because Proxy, unlike VPN, can be used on servers that do not have their own dedicated IP address (which is behind NAT), and such servers are several times cheaper (they can be purchased for $ 2 per year ). Raising your proxy server on Linux is also not an easy task for newbies. But this script will do everything for you. And there are a lot of settings. When installing, the “assistant” will ask which port we need a Proxy (or offer a standard one), ask if authorization by login / password is required (or let everyone who knows the address and port). The script will even take into account the needs of those users who like to drive third-party traffic into the Proxy (through programs like Proxifier) ​​and configure the config as needed. And, of course, he himself will make all the necessary rules in the Firewall (iptables). Setting up a proxy has never been so easy. Hands in the config do not need to climb.

Work with files and programs


In this section, you can install the desired program (package) or remove it. And the most useful there is the correct removal. The fact is that when you install a program, it is very often installed several companion packages necessary for its work. And often, the size of these additional packages exceeds the size of the actual program that you installed. But when you delete your program, only the program itself will be removed, and all the packages that were needed for her (and only her) work will remain and continue to occupy space. In my script, I provided for the complete removal of the program - with all the additional software that was bundled with it. In the script, simply specify the name of the program, then the script will do everything by itself.

System cleaning


In case of active use of the server for hosting, a huge amount of logs of access to sites is often accumulated. The volume of all this garbage can sometimes reach gigabytes. Not everyone knows where and how to remove it. In this section, you can clean these logs. The Apache and Nginx logs are deleted, both as a whole and for a specific user. In addition, from this section, you can remove the old installation packages, which by default remain on the disk after installing the software and continue to take up space.



On this, in fact, for now. The plans, of course, a lot of things still want to add. For example, a benchmark to assess the performance of various server components. Expand support for other operating systems and so on. As time and effort, I actually do it. But, already now, it performs quite a lot of functions required by beginners and is able to greatly simplify their lives.

Now, in fact, a very important question. And on what Linux distributions does it all work? On all versions of CentOS. And also, on all other distributions from Red Hat Enterprise Linux distributions (for example, Scientific Linux). Why RHEL? Well, I wrote the script for myself, but CentOS is closer to me. Well, if we talk about the target audience of this script (beginners), then they, as a rule, no matter what distribution kit to work with. After all, usually they are equally poorly aware of any of them. And RHEL is quite good, stable, undemanding of resources, and, most importantly, almost every VPS hoster is present. The CentOS version at the same time can choose any (5, 6, 7), as well as digit capacity. For all actions, the script analyzes which version of the distribution and takes into account the specifics of this particular version. I usually choose a CentOS 6.x distribution (Minimal possible) with 64 bits.

And most importantly. How to actually get this script? Here you can see the entire source code. Also the project is laid out on githabe. Link: github.com/Brizovsky/Breeze-Easy-Shell

All you need to use it is to create a file [name] .sh and put this content into it. Then run the command "sh [name] .sh". It can be created both on the server and on your computer, and then copied to the server. There is another installation option - download it directly from the github to the server. Personally, I do it like this:
cd /root/
wget https://raw.githubusercontent.com/Brizovsky/Breeze-Easy-Shell/master/breeze.sh -r -N -nd
cat >> /root/.bashrc <<END
alias breeze='cd /root/
sh breeze.sh'
END
exit

«breeze» .

P.S. , . bash , . , . . -, . VPN, Proxy , . .

UPD: . -, , ( ), -, . , , [- ] . ( ), VPS .

Source: https://habr.com/ru/post/309628/


All Articles