Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to install the fpm Packaging tool

2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article to share with you is about how to install fpm packaging tools, Xiaobian think quite practical, so share to everyone to learn, I hope you can read this article after some harvest, not much to say, follow Xiaobian to see it.

1 Install fpm package tool

It is recommended that the first installation be carried out in sequence. It's easy to crash the server around the back, even if it's not installed, it's best to test this package on your own machine.

1.1 first installed

yum -y install ruby rubygems ruby-devel

gem sources-a http://mirrors.aliyun.com/rubygems/

gem sources--remove http://rubygems.org/

gem installfpm

ERROR: Could not find a valid gem 'fpm' (>= 0) inany repository

It may be ruby Alibaba cloud source unstable, add ruby Taobao source

gem sources -a http://ruby.taobao.org/

Errorfetching http://ruby.taobao.org/:

bad response Not Found 404 (http://ruby.taobao.org/specs.4.8.gz)

The address may not be correct, replace it with https

gem sources -a https://ruby.taobao.org/

gem install fpm

ERROR: Could not find a valid gem 'fpm' (>= 0) inany repository

Download error, cannot find, may not delete ruby Alibaba Cloud source, default to find the first added to go, remove

gem sources --remove http://mirrors.aliyun.com/rubygems/

gem install fpm

Buildingnative extensions. This could take awhile...

Buildingnative extensions. This could take awhile...

ERROR: Error installing fpm:

ruby-xz requires Ruby version >=1.9.3.

Ruby version is too low to install the latest fpm, update ruby or install an older version of fpm such as 1.4.0:

gem install fpm -v 1.4.0

Successfullyinstalled clamp-0.6.5

Successfullyinstalled fpm-1.4.0

2gems installed

Installingri documentation for clamp-0.6.5...

Installingri documentation for fpm-1.4.0...

InstallingRDoc documentation for clamp-0.6.5...

InstallingRDoc documentation for fpm-1.4.0...

1.2 Install after snapshot rollback (carrier network may also affect)

yum -y install ruby rubygems ruby-devel

gem sources -a https://ruby.taobao.org/

gem sources--remove http://rubygems.org/

gem install fpm -v 1.4.0

ERROR: Error installing fpm:

json requires Ruby version ~> 2.0.

I don't know how to solve this problem, consider upgrading ruby, then continue to install the following regardless

gem install fpm

Buildingnative extensions. This could take awhile...

Buildingnative extensions. This could take awhile...

ERROR: Error installing fpm:

ruby-xz requires Ruby version >=1.9.3.

Or report this error, how to upgrade ruby 1.8.7 to 1.9.3, but afraid of other software such as problems, so if you are afraid to consider installing it to a special directory, do not overwrite the installation.

wget https://cache.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p125.tar.gz

wget http://pyyaml.org/download/libyaml/yaml-0.1.7.tar.gz

tar xf yaml-0.1.7.tar.gz

cd yaml-0.1.7

./ configure

make

make install

cd ..

tar xf ruby-1.9.3-p125.tar.gz

cd ruby-1.9.3-p125

./ configure

make

make install

ruby --version

ruby1.8.7 (2013-06-27 patchlevel 374) [x86_64-linux]

It's still 1.8.7. What's going on? So look at the end of the successful installation

installingcommand scripts: /usr/local/bin

installinglibrary scripts: /usr/local/lib/ruby/1.9.1

installingcommon headers: /usr/local/include/ruby-1.9.1

installingmanpages: /usr/local/share/man/man1

But the command directory is still/usr/local/bin, the same as before, so I execute ruby -version why is it 1.8.7, strange, can it be said that there is no overwrite, I go, I want to remove this command, recompile

which ruby

/usr/local/bin/ruby

mv /usr/local/bin/ruby /tmp/

which ruby

/usr/bin/ruby

/usr/bin/ruby -version

ruby1.8.7 (2013-06-27 patchlevel 374) [x86_64-linux]

Why is there another one? Damn it, it's haunting me. Move it.

mv /usr/bin/ruby /tmp/ruby2

recompile

make

make install

View path:

which ruby

view version

/usr/local/bin/ruby -version

ruby1.9.3p125 (2012-02-16 revision 34643) [x86_64-linux]

Oh, finally, God has eyes

Then continue to the next step, install fpm, before you have added ruby Taobao source

gem install fpm

-bash:/usr/bin/gem: /usr/bin/ruby: bad interpreter: No such file or directory

What is this situation again, saying that ruby cannot be found, I faint oh, is there a path to write ruby in gem command?

which gem

/usr/local/bin/gem

What's the situation? gem is not in/usr/bin/gem either. Maybe this is the default installation of ruby after installation. Then I'll directly come to a full path

/usr/local/bin/gem install fpm

ERROR: Loading command: install (LoadError)

cannot load such file -- zlib

ERROR: While executing gem ... (NameError)

uninitialized constantGem::Commands::InstallCommand

I'm freaking out. Was I born to watch red screens? Zlib cannot be loaded.

rpm -qa zlib

zlib-1.2.3-29.el6.x86_64

zlib is also there ah, forget it, enter the ruby source directory, install the zlib source code comes with

cd ext/zlib/

ruby extconf.rb

-bash:/usr/bin/ruby: No such file or directory

What's the situation? I didn't do anything. Ruby couldn't be found either. I forgot to use the full path. Maybe PATH variable is written in front of the previous one. The latter one is not used. The default is to use the previous one, but it has been removed, so I can't find it.

/usr/local/bin/ruby extconf.rb

make

make: Nothing to be done for `all'.

echo $?

0

It doesn't seem to be a mistake.

make install

make: Nothing to be done for `install'.

echo $?

0

It doesn't seem to be a mistake.

If you install it again, I don't believe you

/usr/local/bin/gem install fpm

ERROR: Loading command: install (LoadError)

cannot load such file -- zlib

ERROR: While executing gem ... (NameError)

uninitialized constantGem::Commands::InstallCommand

Still no good. Didn't make it work?

cd ../../

make clean

cd ext/zlib/

/usr/local/bin/ruby extconf.rb

It still doesn't work. Sigh, I'll use yum to cure dead horses.

yum install zlib-devel -y

Forget it or not. I don't want to do it anymore. Stupid stuff. This road is not feasible. The whole world will be swallowed by the elderly.

Below I restore snapshot again, according to the first installation once, as well as smooth

Conclusion: It is better to proceed step by step according to the first installation. Maybe there is a wrong step in the middle and some components are installed for you, skipping the so-called

ERROR: Error installing fpm:

json requires Ruby version ~> 2.0.

Whether it's the wrong step or the right step, do it in turn, just do what I say. I've come a long way. It starts with ^V^, don't blame me, I didn't see it clearly.

The above is how to install the fpm packaging tool, Xiaobian believes that some knowledge points may be seen or used in our daily work. I hope you can learn more from this article. For more details, please follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report