Linux install openssl dev

How do I install the OpenSSL libraries on Ubuntu?

I’m trying to build some code on Ubuntu 10.04 LTS that uses OpenSSL 1.0.0. When I run make, it invokes g++ with the «-lssl» option. The source includes:

#include #include #include #include #include #include 
$ sudo apt-get install openssl Reading package lists. Done Building dependency tree Reading state information. Done openssl is already the newest version. 0 upgraded, 0 newly installed, 0 to remove and 3 not upgraded. 
foo.cpp:21:25: error: openssl/bio.h: No such file or directory foo.cpp:22:28: error: openssl/buffer.h: No such file or directory foo.cpp:23:25: error: openssl/des.h: No such file or directory foo.cpp:24:25: error: openssl/evp.h: No such file or directory foo.cpp:25:25: error: openssl/pem.h: No such file or directory foo.cpp:26:25: error: openssl/rsa.h: No such file or directory 

How do I install the OpenSSL C++ library on Ubuntu 10.04 LTS? I did a man g++ and (under «Options for Linking») for the -l option it states: » The linker searches a standard list of directories for the library. » and «The directories searched include several standard system directories. » What are those standard system directories?

You’re right about the -dev naming convention. You might also use the synaptic package manager to list all packages whose names contain libssl — browsing that list and their descriptions would likely give you the clue.

I know this question is quite dead by now but since I recently found it I figure someone else might too. If you want to list all packages that are similar to a certain name, I like to use >aptitude search It does not require root privilege level to run a search.

just to add to Evan’s statement, recent versions of Ubuntu are coming without the aptitude command available. apt-cache search works the same way (almost) now.

10 Answers 10

You want to install the development package, which is libssl-dev:

sudo apt-get install libssl-dev 

But this is not the version he wanted (1.0.0), which is not packaged for 10.04. See this answer for 1.0.0: stackoverflow.com/questions/3153114/…

Ah, good call. I only noticed at the time that he was trying to use the development libraries but wasn’t installing the -dev package. I didn’t even notice the version number.

This is the right reference here: technologyskill.ga/install-openssl-manually-on-linux or howtoforge.com/tutorial/… libraries and header files are found under the same directory after installation: /usr/local/ssl

@GeorgeSp I think so, but it’s still more «natural» to build them in a custom directory using this instruction stackoverflow.com/a/49578644/7315276

All of these answers are very outdated and from when the package was still being developed. You can now just use the «normal» command listed below:

Читайте также:  Open linux firewall ports are open

Edit: OP’s question is poorly worded. after all, OpenSSL is a library itself, so I read his question too quickly before answering. The command above installs «normal» OpenSSL.

Toward the bottom of his question he mentions that make fails, suggesting he is compiling the package manually. And yes, even if you download the TAR ball, it will include all of the openssl and libssl files, which you can then make from.

What OP is really asking for is the OpenSSL Development Library, in which case you can first install OpenSSL using the above command, and then run this afterwards:

sudo apt install libssl-dev 

I found a detailed solution here: Install OpenSSL Manually On Linux

Источник

How to install openssl-devel on Ubuntu using apt-get?

Error message is pretty verbose and says ssl library files are missing on the server. So we need to install it first before proceeding.

On Centos machines you can install the libraries using “yum” repo manager like following

1 2 3 yum install openssl – devel

On Ubuntu, when you try the same with “apt-get” install

1 2 3 4 5 6 7 8 root @ test : / server – 5.7.1 # apt-get install openssl-devel Reading package lists . . . Done Building dependency tree Reading state information . . . Done E : Unable to locate package openssl – devel root @ test : / server – 5.7.1 #

It is not able to find a package named “openssl-devel” . After little bit googling, i found out there is a similar package named “libssl-dev”

1 2 3 4 5 6 7 8 9 10 11 12 13 14 root @ test : / server – 5.7.1 # apt-get install libssl-dev Reading package lists . . . Done Building dependency tree Reading state information . . . Done The following additional packages will be installed : libssl – doc zlib1g – dev The following NEW packages will be installed : libssl – dev libssl – doc zlib1g – dev 0 upgraded , 3 newly installed , 0 to remove and 30 not upgraded . Need to get 2591 kB of archives . After this operation , 10.5 MB of additional disk space will be used . Do you want to continue ? [ Y / n ] y

Now we will check the info for newly installed package

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 root @ test : / server – 5.7.1 # dpkg -s libssl-dev Package : libssl – dev Status : install ok installed Priority : optional Section : libdevel Installed – Size : 7028 Maintainer : Ubuntu Developers & lt ; ubuntu – devel – discuss @ lists . ubuntu . com & gt ; Architecture : amd64 Multi – Arch : same Source : openssl Version : 1.0.2g – 1ubuntu4.6 Depends : libssl1 . 0.0 ( = 1.0.2g – 1ubuntu4.6 ) , zlib1g – dev Recommends : libssl – doc Description : Secure Sockets Layer toolkit – development files This package is part of the OpenSSL project ‘ s implementation of the SSL and TLS cryptographic protocols for secure communication over the Internet . . It contains development libraries , header files , and manpages for libssl and libcrypto . Original – Maintainer : Debian OpenSSL Team
Читайте также:  Intel sandy bridge linux

This package provides libraries and header files for “libssl” and “libcrypto”. PDF Bedienungsanleitungen

Источник

How to install OpenSSL in Ubuntu? [SOLVED]

OpenSSL is an open source software library for applications that protect against eavesdropping on communications over computer networks or the need to identify the other party. It is widely used by Internet servers, including most HTTPS websites.
In this article we will tell you how to install OpenSSL on Ubuntu 22.04.

In this article, both the installation from the repository and the installation steps from the source code will be explained.

Method-1: Install From Repository

Ubuntu has OpenSSL installed most of the time:

foc@ubuntu22:~$ dpkg -l | grep openssl ii openssl 3.0.2-0ubuntu1.6 amd64 Secure Sockets Layer toolkit - cryptographic utility

If it is not installed, first start by updating the package list:

foc@ubuntu22:~$ sudo apt update -y

Then install openssl package:

foc@ubuntu22:~$ sudo apt install openssl -y

Package version after installation:

foc@ubuntu22:~$ openssl version OpenSSL 3.0.2 15 Mar 2022 (Library: OpenSSL 3.0.2 15 Mar 2022)

Installation was successful completed.

Method-2: Install From Source Code

Before the installation update the packages list:

foc@ubuntu22:~$ sudo apt update -y
foc@ubuntu22:~$ sudo apt install build-essential checkinstall zlib1g-dev -y

Go to the official website and right click on the download link and copy the link:

How to install OpenSSL in Ubuntu? [SOLVED]

Download the compressed file with the wget command:

foc@ubuntu22:~$ sudo wget https://www.openssl.org/source/openssl-3.1.0-alpha1.tar.gz --2022-12-11 11:37:46-- https://www.openssl.org/source/openssl-3.1.0-alpha1.tar.gz Resolving www.openssl.org (www.openssl.org). 104.70.110.18, 2a02:26f0:cb00:1a0::c1e, 2a02:26f0:cb00:186::c1e Connecting to www.openssl.org (www.openssl.org)|104.70.110.18|:443. connected. HTTP request sent, awaiting response. 200 OK Length: 15343477 (15M) [application/x-gzip] Saving to: ‘openssl-3.1.0-alpha1.tar.gz’ openssl-3.1.0-alp 100%[=============>] 14.63M 1.84MB/s in 6.6s 2022-12-11 11:37:53 (2.21 MB/s) - ‘openssl-3.1.0-alpha1.tar.gz’ saved [15343477/15343477]

Then unzip the compressed file, move it to /usr/local/src :

foc@ubuntu22:~$ sudo tar -xzvf openssl-3.1.0-alpha1.tar.gz -C /usr/local/src/ && sudo mv /usr/local/src/openssl-3.1.0-alpha1/* /usr/local/src

Switch to /usr/local/src/ directory:

foc@ubuntu22:~$ cd /usr/local/src/

Run the following command to start compiling:

foc@ubuntu22:/usr/local/src$ sudo ./config --prefix=/usr/local/ssl --openssldir=/usr/local/ssl shared zlib Configuring OpenSSL version 3.1.0-alpha1 for target linux-x86_64 Using os-specific seed configuration Created configdata.pm Running configdata.pm Created Makefile.in Created Makefile Created include/openssl/configuration.h ********************************************************************** *** *** *** OpenSSL has been successfully configured *** *** *** *** If you encounter a problem while building, please open an *** *** issue on GitHub *** *** and include the output from the following command: *** *** *** *** perl configdata.pm --dump *** *** *** *** (If you are new to OpenSSL, you might want to consult the *** *** 'Troubleshooting' section in the INSTALL.md file first) *** *** *** **********************************************************************

Then run «make» and «make test»

foc@ubuntu22:/usr/local/src$ sudo make && sudo make test

If Result: Pass, you can continue the installation with the «make install» command.

foc@ubuntu22:/usr/local/src$ sudo make install

If you have successfully installed OpenSSL, configure the library directory. OpenSSL will look for the file in the ‘ /usr/local/ssl/lib ‘ directory. We will add a file to the ld.so.conf.d directory under the /etc directory and make it reach the ‘ /usr/local/src/ssl ‘ files.

foc@ubuntu22:/usr/local/src$ cd /etc/ld.so.conf.d/ foc@ubuntu22:/etc/ld.so.conf.d$ sudo nano openssl-3.1.0.conf

Create necessary links and cache for newly added libraries with ldconfig :

foc@ubuntu22:/etc/ld.so.conf.d$ sudo ldconfig -v /usr/local/ssl/lib64: (from /etc/ld.so.conf.d/openssl-3.1.0.conf:1) libcrypto.so.3 -> libcrypto.so.3 libssl.so.3 -> libssl.so.3 

Backup and remove OpenSSL files located in /usr/bin/openssl or /bin/openssl so you can use them again in case of problems.

foc@ubuntu22:/etc/ld.so.conf.d$ sudo mv /usr/bin/c_rehash /usr/bin/c_rehash.backup foc@ubuntu22:/etc/ld.so.conf.d$ sudo mv /usr/bin/openssl /usr/bin/openssl.backup

Add the PATH of the new openssl version:

foc@ubuntu22:/etc/ld.so.conf.d$ export PATH="/usr/local/ssl/bin:$PATH" foc@ubuntu22:/etc/ld.so.conf.d$ source ~/.bashrc

View the new OpenSSL version:

foc@ubuntu22:/etc/ld.so.conf.d$ openssl version OpenSSL 3.1.0-alpha1 1 Dec 2022 (Library: OpenSSL 3.1.0-alpha1 1 Dec 2022)

Generating a Sample SSL Certificate

Create a claim for the certificate to be generated:

foc@ubuntu22:~$ openssl genrsa -des3 -passout pass:x -out server.pass.key 2048

Extract the encrypted key:

foc@ubuntu22:~$ openssl rsa -passin pass:x -in server.pass.key -out server.key writing RSA key
foc@ubuntu22:~$ openssl req -new -key server.key -out server.csr You are about to be asked to enter information that will be incorporated into your certificate request. What you are about to enter is what is called a Distinguished Name or a DN. There are quite a few fields but you can leave some blank For some fields there will be a default value, If you enter '.', the field will be left blank. ----- Country Name (2 letter code) [AU]:TR State or Province Name (full name) [Some-State]:Ankara Locality Name (eg, city) []:Cankaya Organization Name (eg, company) [Internet Widgits Pty Ltd]:GolinuxCloud Organizational Unit Name (eg, section) []:Technology Common Name (e.g. server FQDN or YOUR name) []:golinuxcloud Email Address []:foc@golinuxcloud.com Please enter the following 'extra' attributes to be sent with your certificate request A challenge password []:Password@1 An optional company name []:Password@1

Then create the certificate:

foc@ubuntu22:~$ openssl x509 -req -sha256 -days 365 -in server.csr -signkey server.key -out server.crt Certificate request self-signature ok subject=C = TR, ST = Ankara, L = Cankaya, O = GolinuxCloud, OU = Technology, CN = golinuxcloud, emailAddress = foc@golinuxcloud.com
foc@ubuntu22:~$ ls -l -rw-rw-r-- 1 foc foc 1350 Dec 11 12:04 server.crt -rw-rw-r-- 1 foc foc 1143 Dec 11 12:04 server.csr -rw------- 1 foc foc 1704 Dec 11 12:01 server.key -rw------- 1 foc foc 1854 Dec 11 12:00 server.pass.key 

Summary

We explained how to install OpenSSL on Ubuntu with 2 different methods. If there is no reason, it is recommended to install from the Ubuntu repository.

Читайте также:  Special symbols in linux

After the installation, we talked about creating a certificate in a simple way. For more, we share the links below.

What is NEXT?

References

Didn’t find what you were looking for? Perform a quick search across GoLinuxCloud

If my articles on GoLinuxCloud has helped you, kindly consider buying me a coffee as a token of appreciation.

Buy GoLinuxCloud a Coffee

For any other feedbacks or questions you can either use the comments section or contact me form.

Thank You for your support!!

Источник

Оцените статью
Adblock
detector