1

I never went outside of windows before last week, I was asked to make a VM with elasticsearch/logstash/kibana/jdk8 on it.

I'm using a regular non sudoer user.

I extracted each tar.gz file and got 4 folder.

First to launch elastic search I had to make the 'elastisearch' file executable using chmod +x. Then it failed because other files needed to be executable. Then it failed because some files in the bin folder of the java JDK needed to be executable.

Is there an other way to install stuff on linux? or each time it's a game about "let's see which file I need to chmod"?

Thanks.

Ps : I'm using CentOs 7

1
  • The -p option is best. Also if doing it manually you can use chmod -R to recursively do subdirectories. – Michael Durrant Mar 10 '16 at 1:21
3

Is there an other way to install stuff on linux? or each time it's a game about "let's see which file I need to chmod"?

Yeah it's called vendors using the native package managers which solves a whole host of problems related to releasing software, including permissions. Some ISV's just have a habit of "the admin will figure it out" become the standard expectation. There are some cases where you have to do that but a lot of problems have already been solved if they would just adhere to a workflow.

In your specific case, you probably didn't specify the p option to your tar command which would've instructed it to preserve file permissions on the resulting files if they were included in the tar archive to begin with (you just have to try it and see).

To your original question:

Why do I need to set some file as executable?

It's just an access control measure. It gives you a way to not have a file be ran by itself. For example, if a directory tree for an installer includes the final executables but you want to make it so they can't execute anything other than the installer program. Or if you're working on a script but don't want anyone to execute it until you're finished.

3
  • Suggest you bold the part about the p switch to the tar command, as it's the most directly relevant part of this answer. Upvoted. – Wildcard Mar 10 '16 at 1:10
  • oh, I'm going to try tar -p then. I actually extracted the tar.gz on windows and then put it in a .zip because I already knew the 'unsip' command. Then I send them over ssh and extracted them using unzip. First time I encoutered tar.gz, files. – sliders_alpha Mar 10 '16 at 8:59
  • awesome, the -p parameters keep the permissions and I don't need to chmod anything. – sliders_alpha Mar 10 '16 at 10:19
3

Yes there is another way to install software on linux that usually dies not require you to make scripts executable by hand: Package Managers.

If you are using CentOS in your case that would be 'yum'. This program can install software that is found in so called repositories that come with your OS of choice.

In the following link the installation of logstash, elasticsearch and kibana on CentOS is explained.

https://www.digitalocean.com/community/tutorials/how-to-install-elasticsearch-logstash-and-kibana-elk-stack-on-centos-7

To go back to your very question: If your OS' repository does not include the software you want to install, then you could go looking for additional repositories that provide it. Only if those two options are not available then you should consider installing software manually, especially if you are an unexperienced user you should always prefer to install software from repositories.

Please note that you need root access to the machine you want to use 'yum' on.

Here's a little tutorial on yum: https://linuxmoz.com/linux-yum-tutorial/

1
  • I see, well I don't like this, because it install everything in the same folder merging everything together. – sliders_alpha Mar 10 '16 at 8:58
0

Files need to be made executable if they are to be executed. Unix systems use permissions to determine which files are executables, not filename extensions like Windows.

It's rare to need to make some files executable manually. When you compile a program, the compiler will do it. When you unpack files from an archive, the archive specifies their permissions. If the archive where you unpacked that program from had invalid permissions, that means that whoever made that archive did something odd to cause the permissions to be bad.

The normal way to install software on Linux is via the package manager. You should use other methods only when there is no package available for your distribution or if you need to install software as a non-root user. CentOS doesn't carry Elasticsearch, but Elasticsearch distribute packages for some distributions including CentOS ≥6. Using the RPM packages provided by Elasticsearch would be the easiest way to install it.

I checked the official tar archive distributed by Elasticsearch, it does have execute permissions where needed. So get this archive and unpack it instead of whatever broken archive you used.

But if you're making a VM, I don't understand your statement about not being root. It's irrelevant that you aren't root on the host; if you're setting up a VM and in particular installing the OS in it then you're root in the VM, and you can install the RPM packages in the OS running in the VM.

0

There are alternatives. For development for example, I'd recommend using Vagrant. There are a number of ELK vagrant boxes out there that will allow you to install the ELK stack (with Elasticsearch, Logstash and Kibana) all in one and using one simple vagrant command (will be writing a tutorial on this soon). The vagrant boxes will install all necessary components for you, including Java. And there are hosted ELK solutions of course to try out (disclosure - I work for an ELK-as-a-service company).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.